|
-
May 3rd, 2006, 03:44 PM
#1
Thread Starter
Fanatic Member
<form action="insert.php" method="post">
can I make my page just go to a certain script on the same page after they click the button, like instead of going to insert.php, can I have like a sub on the page it calls to with the script? If so how, I am new to PHP...
also how do you program a redirect? like it it did go to a confermation page or something, how would I make it return automatically?
Software languages known:
Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known:
Directx 7 and 8
Internet languages, in the process of learning:
HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
-
May 3rd, 2006, 06:01 PM
#2
<?="Moderator"?>
Re: <form action="insert.php" method="post">
to redirect a page use the header() function
PHP Code:
header('location: script.php');
As for the other bit just use POST of GET variables that have been passed to the script
PHP Code:
if(isset($_GET['action']))
{
switch($_GET['action'])
{
"func1":
yourfunction_1();
break;
"func2":
yourfunction_2();
break;
}
}
-
May 4th, 2006, 01:40 PM
#3
Thread Starter
Fanatic Member
Re: <form action="insert.php" method="post">
Im sorry would you mind explaining this in alittle more detail please?
Software languages known:
Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known:
Directx 7 and 8
Internet languages, in the process of learning:
HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
-
May 5th, 2006, 08:43 AM
#4
Re: <form action="insert.php" method="post">
What John's code is doing, is it is checking if the variable being passed by $_GET has a value. With this code:
Code:
if (isset($_POST["variable"]))
In your case, since you're passing by POST, you would use $_POST rather than $_GET.
The Switch function reads the value of the POST and if its equal to 1 thing, it does function 1, otherwise, it does function2.
HTH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|