Jump to content

Help with simple script...


sandecki

Recommended Posts

Hey everyone,

 

I have a simple question and hopefully someone can be kind enough to help :).  I need to make a simple php script\form to do the following....

 

1. Allow some to enter their zipcode in the text field & hit submit.

 

2. This will then open a new browser page with the following URL below...

 

http://www.google.com/maps?f=q&hl=en&geocode=&q=self+storage+ZIPCODEHERE&ie=UTF8&z=12&om=1

 

The bolded text is where the zipcode should of been inserted. The entire URL must stay intact, I just need this simple thing and my lack of php knowledge really makes it awful, hopefully someone can help. I'd like to give thanks very much to whoever decides to help me with this!

 

 

Link to comment
https://forums.phpfreaks.com/topic/71170-help-with-simple-script/
Share on other sites

Like this:

<?php
if(isset($_POST['submit'])&&!empty($_POST['zip'])){
     header("Location: http://www.google.com/maps?f=q&hl=en&ampgeocode=&q=self+storage+".$_POST['zip']."&ie=UTF8&z=12&om=1");
     exit;
}else{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
     <input type="text" name="zip">
     <input type="submit" name="submit" value="Submit">
</form>

<?php } ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.