1

I am creating a site for a city and am going to add a phone number lookup box on it. I would like it to be pure html and simple. I need somekind of user input boxes so in one box they could type the first name, then next box the last name, then a city box, then a state box. So when they push submit it fits it in this url: http://www.yellowpages.com/whitepages?first=FIRSTNAMEHERE&last=LASTNAMEHERE&zip=ZIPCODEHERE&state=STATEHERE

I have tried jQuery and it sort of worked but want to move on to pure html.

The code I have tried is:

 <input id="input" name="url" onfocus="this.value='';" style="border: 1px solid 
#A4A4A4; font-size: 0.9em; padding: 5px; width: 350px;" type="text" value="Type url here..">
<input onclick="window.open('http://www.yellowpages.com/whitepages?first=&last=&zip=&state=' + 

window.document.getElementById('input').value.replace(/^https?:\/\//,''))" style="font-family: Arial, sans-serif; font-size: 0.9em; margin: 2px 0; padding: 

4px; width: 100px;" type="button" value="Surf">

I know I am making the mistake somewhere in the "onclick" value.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

Sounds like you need just a simple GET request for your form. A GET request means it passes data to a page via URL parameters. This code takes every submitted input name and puts the data it contains after your yellowpages URL.

<form method="get" action="http://www.yellowpages.com/whitepages">
    <input name="first" type="text">
    <input name="last" type="text">
    <input name="zip" type="text">
    <input name="state" type="text">
    <input type="submit" value="Submit">
</form>
blazerunner44
  • 657
  • 8
  • 19
  • thanks dude, you are really helpful! I will answer this as answering my question with or without this but, I need to know if there is any way to make it "hint" in eachbox. But still through HTML? THANKS – monsterjamfan30 Sep 10 '15 at 11:44
  • I think you are looking for `placeholder`. Add it to each of your inputs like so `` – blazerunner44 Sep 10 '15 at 12:52
  • Sweet dude! Thanks a lot! I love it when people help me out with my problems, I was looking everywhere to find that! Thanks SO MUCH :) – monsterjamfan30 Sep 12 '15 at 00:34
  • I think you were just over thinking things with all of that jQuery :) The simplest solutions are often the best. Glad I was able to help. – blazerunner44 Sep 12 '15 at 01:05
  • and I dont know if you want to help but, I have some css buttons: http://carbontx.weebly.com/ and the buttons href only works on a line across near the top of the button. Is there any way to make it clickable on the whole button? The buttons are from : http://codepen.io/benague/pen/bLBCd and the HTML code I am using a simple code that calls the CSS is: – monsterjamfan30 Sep 12 '15 at 02:00
  • lol, what did you do to mess up the code from codepen? The codepen code looks so nice and clean and hard to mess up :) Do me a favor and copy the whole `
    ` div (with all the buttons in it) from codepen and then simply import the css file that is there in codepen. Since the codepen example doesn't have the buttons as links, just add an href attribute to each of them like so `Blue Button`. If that still doesn't work, let me know. I would love to log into your weebly account and "fix" the issue ;)
    – blazerunner44 Sep 12 '15 at 04:47
  • lol...It was some kind of bug in the HTML. I deleted all the HTML and pasted it again and it fixed. Thanks. Stupid Weebly! Thanks Dude, you are the best! – monsterjamfan30 Sep 12 '15 at 20:13