<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?
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;
}
}
Re: <form action="insert.php" method="post">
Im sorry would you mind explaining this in alittle more detail please?
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