Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
185
rated 0 times [  192] [ 7]  / answers: 1 / hits: 26390  / 12 Years ago, tue, march 27, 2012, 12:00:00

Weird question this, going round in circles.



I have 2 pages.



Page 1. Has a button on it. Like



<form action=goto_page_2.php><p class=longdesc><span class=spanBold>Scrap Collections in North Lakes:</span><br />
<button class=readViewMoreBtn value=North Lakes>Book a Collection in North Lakes</button>
</p></form>


The above is a simple mockup. But what I want to do is, onclick of the button, parse the Value to ...



Page 2. Which has a form built in.



One of the fields is Suburb.



<!-- EMAIL SUBURB -->            
<span class=commonControlLabel>Suburb:</span>&nbsp;
<span class=commonControlLabelItalic>(required)</span>
<span id=contactSuburbErrorMsg class=commonControlErrorMsg></span><br />
<input class=commonInput type=text id=inputSuburb value=/><br />


So what I want to do, is grab the VALUE of the button on PAGE 1, and add it to the Value in the input element on Page 2.



To complicate matters, Page 1. Has quite a few buttons, with different values, all unique, which we would like to pass, to the input element. Obviously onlcick of the button on page 1 we go direct to page 2.


More From » php

 Answers
108

Have the button post it's value to Page2:



Page1, I added type=submit and name=suburb



<button type=submit name=suburb class=readViewMoreBtn value=North Lakes>Book a Collection in North Lakes</button>


Page2: I added the php part in the value attribute



<input class=commonInput type=text id=inputSuburb value=<?= $_POST['suburb'] ?>/>

[#86591] Sunday, March 25, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tobyl

Total Points: 598
Total Questions: 110
Total Answers: 114

Location: Vietnam
Member since Sat, Feb 12, 2022
2 Years ago
tobyl questions
Tue, Aug 10, 21, 00:00, 3 Years ago
Wed, Jan 13, 21, 00:00, 3 Years ago
Tue, Dec 1, 20, 00:00, 4 Years ago
;