Page 1 of 1

Posted: Sat Nov 13, 2004 2:50 pm
by ramagates
any one knows how to redirect a form to a page after submit? i mean the code!

Posted: Sat Nov 13, 2004 3:15 pm
by djot
-
Hi,

??????? Do you want to pass a web form to a script/different page? What do you mean with passing the code? Or do you need the code for a form that is submitted to a script and processed in the script, redirecting/showing the results?

djot
-

Posted: Sat Nov 13, 2004 3:49 pm
by scorphus
The following example shows how to redirect the form1's contents to procframe.php page using the POST method:

Code: Select all

<form name="form1" method="post" action="procframe.php">
<input type="text" name="name" />
<input type="submit" name="submitt" />
</form>
The input named submitt is named intentionaly, because of this.

Hope it helps. Please lemme know if it doesn't!
Scorphus.

RE:

Posted: Sun Dec 05, 2004 10:58 pm
by harrisonad
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....

Posted: Sun Dec 05, 2004 11:18 pm
by ol4pr0
Simple example

Get values from form1 and get the information on form2 just copy and paste that.

Form1.html

Code: Select all

&lt;form name="form1" action="form2.php" method="post"&gt;
Name: &lt;input type="text" name="name"&gt;&lt;/input&gt;
&lt;input type="submit" name="submit" value="Send to form2"&gt;
&lt;/form&gt;
Form2.php

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";
}