Form redirection
Moderator: General Moderators
- scorphus
- Forum Regular
- Posts: 589
- Joined: Fri May 09, 2003 11:53 pm
- Location: Belo Horizonte, Brazil
- Contact:
The following example shows how to redirect the form1's contents to procframe.php page using the POST method:
The input named submitt is named intentionaly, because of this.
Hope it helps. Please lemme know if it doesn't!
Scorphus.
Code: Select all
<form name="form1" method="post" action="procframe.php">
<input type="text" name="name" />
<input type="submit" name="submitt" />
</form>Hope it helps. Please lemme know if it doesn't!
Scorphus.
- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
RE:
correct me if i don't get your question right
are you talking about like this:
FORM.php -> submitted to PROCESS.php -> then redirect $_POST variables to ANOTHER.php
if that's what you're asking then i must say that you need to have another copy of the form in FORM.php to PROCESS.php with all buttons or textboxes given values from $_POST variables received from FORM.php
then, instead of redirecting to ANOTHER.php (because there is no $_POST variables sent by redirecting), just automatically submit the form on loading.
as a result, you will preserve all $_POST variables sent by FORM.php upto the ANOTHER.php
However, if this is not your question, just ignore what i have said....
are you talking about like this:
FORM.php -> submitted to PROCESS.php -> then redirect $_POST variables to ANOTHER.php
if that's what you're asking then i must say that you need to have another copy of the form in FORM.php to PROCESS.php with all buttons or textboxes given values from $_POST variables received from FORM.php
then, instead of redirecting to ANOTHER.php (because there is no $_POST variables sent by redirecting), just automatically submit the form on loading.
as a result, you will preserve all $_POST variables sent by FORM.php upto the ANOTHER.php
However, if this is not your question, just ignore what i have said....
Simple example
Get values from form1 and get the information on form2 just copy and paste that.
Form1.html
Form2.php
Get values from form1 and get the information on form2 just copy and paste that.
Form1.html
Code: Select all
<form name="form1" action="form2.php" method="post">
Name: <input type="text" name="name"></input>
<input type="submit" name="submit" value="Send to form2">
</form>Code: Select all
if (isset($_POST['submit'])) # checking if submit button has been pressed
{
if (!empty($_POST['name'])) # checking if a name was entered
{
echo "You have entered the following name: " .$_POST['name'];
}
else # no name was entered in the text field on form1.html
{
echo "Sorry but you did not enter any name";
}
}
else # no submit button was pressed, just an example~!
{
echo "You tried to directly open this page, please go back to form1.html";
}