Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (bgrg007):

HELP with php/html! i have a textbox in page1.php page. I type "hello" in it, and when i click the submit button, page2.php page appears and has the word, "hello". But when i return to is returned to page1.php, "hello" is no more on textbox. It is blank. Then, when I come back to page2.php, it is blank as well. So, my question is how can I save my text values in both pages?

OpenStudy (e.mccormick):

Are you using the back button or some button on the page?

OpenStudy (bgrg007):

the first page has an edit button that takes me to the second page. second page has the submit button. i just click between these buttons to go back and forth. second page has a text box where i write stuff.

OpenStudy (bgrg007):

echo "<textarea name = box value = " . $_POST['box'] . "> </textarea>"; The line is above is from page 2. $text1 = $_POST["box"]; echo $text1; The two lines above are from page 1.

OpenStudy (e.mccormick):

Basically, to get things from one page to the next needs some sort of form. However, for it to go backwards it also needs a form. So the first page has to be made to take in data from the second and the second from the first. This keeps the data alive as toyu click on buttons, tabs, etc. In client side scripting there are some other things you can do, but for server side scripting you are limited.

OpenStudy (bgrg007):

yea, i added the forms where the 'form action' of the first page is the second page and for the second page, its the first.

OpenStudy (e.mccormick):

Did you put in a conditional test to make sure the first page only sets the form value to nothing if it is not getting called by the second page?

OpenStudy (bgrg007):

no, but if i did so, does that also lead to text values being saved?

OpenStudy (e.mccormick):

Well, it is more about them not being cleared when you go to the first page. I am not sure what you are doing to initialize the value to nothing. But also not sure how much that is needed. I am not PHP skilled, so working form basi programming principals and what I remember from some perl-cgi forms I did work with before.

OpenStudy (woodrow73):

You could mess with sessions.. getting creative with that could definitely yield the result you're looking for.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
HeyItsAlicia: Mits midnight!!! Happy 16th bday to me !!
4 minutes ago 16 Replies 4 Medals
XShawtyX: Art
4 hours ago 1 Reply 1 Medal
RAVEN69: My drawing so far is actually fire
1 week ago 9 Replies 2 Medals
PureSoulless: is staying at your friend's house while you're homeless legal.
2 weeks ago 5 Replies 1 Medal
whyjustwhy: i did that one TV girl trend with blake (aka @ShadowKid3)
1 week ago 12 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!