June 4, 200917 yr I there a way so that when someone clicks on the 'book me an alarm specialist' link it will automatically fill in the trade section of the form on the page it links to. I have about 20 pages linking to the form page all coming from a different trade. http://www.elitetradesmen.com/alarmspecialists.html
June 4, 200917 yr It would be possible with PHP. If you sent a GET value of the trade in the linked URL then on the form page the PHP script could read the GET and fill the field with the value.
June 5, 200917 yr Author It would be possible with PHP. If you sent a GET value of the trade in the linked URL then on the form page the PHP script could read the GET and fill the field with the value. Could someone give me an axample of how the code relating to this would look, on both the pages. I understand what you mean but i have no idea how to do it.
June 5, 200917 yr Could someone give me an axample of how the code relating to this would look, on both the pages. I understand what you mean but i have no idea how to do it. Sure, you need to update the inward links to include the get variable: http://www.elitetradesmen.com/searchtrades.html?trade=Alarm%20Specialist This will send the GET veriable 'trade' with the value 'Alarm Specialist'. The %20 in the a space encodeing. In the form for need to add the value parameter to the text field and then use PHP to print the GET to the HTML: <input type="text" name="FirstName2" value="<?php echo $_GET["trade"]; ?>" /> The searchtrades.html page will have to either be renamed to .php or use htaccess to parse it as a PHP file. Hope that helps.
June 5, 200917 yr Hi speed, This is a very basic way of doing it, but it should work fine. Link: <a href="http://www.elitetradesmen.com/searchtrades.php?trade=Alarm%20Specialist">Book me an alarm specialist</a> Form: (Ammend your trade input box with this:) <input type="text" name="FirstName2" value="<?PHP echo $_GET['trade']; ?>" /> I noticed that your form page is a .html document, you'll need to make this a .php else the PHP code won't work. Hope this helps.
June 5, 200917 yr Ahh oops. Good answer though Microfrost I was jus thinking the same back. Thought you copied me for a second
June 5, 200917 yr Author I understood that till you said to change the page to PHP? I'm sorry, this is my first attempt at a web site so its all new to me. If there is an easy way to change to php, i will do a search later but i never seem to be able to find anything which explains it well enough for me to understand at the moment.
June 5, 200917 yr You just need to rename the file to .php rather than .html. And of course then update all the links to address it.
June 5, 200917 yr Author Cheers, didn't expect it to be that simple. Must be frustrating for you guys but just want to say that even simple advice like that is really appreciated.
June 5, 200917 yr It's not frustrating at all! We all have to start somewhere. The "Oh dear" comment was because Microfrost and I kept double posting, not because you hadn't understood.
June 5, 200917 yr Once apon a time I didn't know what a index file was and linked to my homepage as someusername.freeserve.co.uk/homepage.html.
June 5, 200917 yr Author Ok i've done something wrong. I'm getting a value appear in the text box but not the right one. Can someone tell me what i've done wrong.
June 5, 200917 yr Ok i've done something wrong. I'm getting a value appear in the text box but not the right one. Can someone tell me what i've done wrong. you've simply put the <?PHP echo $_GET['trade']; ?> Into the wrong text field. try changing it to a different text field untill you get the right one. Hope this helps. Ben
June 5, 200917 yr Ok i've done something wrong. I'm getting a value appear in the text box but not the right one. Can someone tell me what i've done wrong. If you're still having problems tomorrow drop me an email on tom[at]tombeynon.co.uk and I'll help you sort it out I'd do it tonight but the pub calls...
Create an account or sign in to comment