Page 1 of 1

submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 6:25 pm
by inosent1
hi

i have a simple mission: the user submits a mailer form, with data in fields to be sent, then i want there to be a new page displayed but the catch is i want the data from one of the fields of the form mailer to be put inside of a text box on the new page

is this possible? is there a code example i can see?

thanks

Re: submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 6:47 pm
by daedalus__

Re: submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 9:01 pm
by inosent1
thanks, but i did not readily see the code i was looking for there

Re: submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 9:06 pm
by daedalus__
the first result of the google search.

if that didnt help then i must not understand the question.

you wanted to take data posted to the page by a form and output it to the screen right?

Re: submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 9:50 pm
by inosent1
yes i must not have been very clear

page 1 has two fields

Name
Number

Submit

submit sends to my email

then i want a new page to show up with another form, which has a form field called 'name' and i want the new page to show this form with this field and have the name filled in, not just displayed, but a field filled in

i will eventually figure it out by going through 100 tutorials, but if there is some code readily available that can do this that would be grreat

thanks

Re: submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 9:53 pm
by daedalus__
well you dont really need to navigate to a new page

put the new form on the page that sends the email

then to fill in the form you just set the value attribute of the input element.

Re: submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 10:25 pm
by inosent1
for what i am trying to do a new page is necessary

in some code i have there is this

Code: Select all

 
<?php
                      
                      if ($emessage==1)
                      {
                      echo "<span class='style2'><b>Thanks, the data has been sent!</b></span>";
                      }
                      ?>
 
 
 
what this does is after the form is submitted displays on the same page the text shown.

but i want to fill in a field in a specific form, let's say the form is called 'form2' and the field name is 'name'

instead of the code above, assuming 'form2' exists on the same page, what code do i use so after i submit the form the awaiting field gets filled in?

thanks

Re: submit form, and then carry a variable to a new page

Posted: Fri Nov 27, 2009 11:15 pm
by daedalus__
*sigh*

you dont need a new page just a conditional statement that sets the state of the page. form1, form2, or success or whatever

if you want to carry the variable over to the new page you are going to have to post using a hidden form or pass it using a query string.

so you display the welcome page welcome.php then have it redirect or link to the mail form page

thanks for the mail! click <a href="mail.php?name=daedalus">here</a> to return!

then on mail.php you access the name variable through the $_GET super global

<input type="text" value="<?php $_GET['name'] ?>

http://us3.php.net/manual/en/tutorial.forms.php

Re: submit form, and then carry a variable to a new page

Posted: Sat Nov 28, 2009 1:44 pm
by inosent1
unless i have a working example i'll never figure it out. thanks for ur ideas