submit form, and then carry a variable to a new page
Moderator: General Moderators
submit form, and then carry a variable to a new page
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
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
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: submit form, and then carry a variable to a new page
thanks, but i did not readily see the code i was looking for there
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: submit form, and then carry a variable to a new page
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?
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
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
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
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: submit form, and then carry a variable to a new page
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.
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
for what i am trying to do a new page is necessary
in some code i have there is this
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
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>";
}
?>
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
- daedalus__
- DevNet Resident
- Posts: 1925
- Joined: Thu Feb 09, 2006 4:52 pm
Re: submit form, and then carry a variable to a new page
*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
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
unless i have a working example i'll never figure it out. thanks for ur ideas