.php to mapquest

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dino3
Forum Newbie
Posts: 9
Joined: Mon Jan 17, 2005 12:22 am
Location: winterpark Fl

.php to mapquest

Post by dino3 »

I am a student and I was stuck with the task of coding a .php database structure for my group with out any knowlage besides some books, I have read php for the world wide web, php for dummies, and mysql/php database applications, and I am trying to figure out how to code a php document that will look into my database file with zipcodes in it, and will, after doing some inhouse math, send you to mapquest to show a map based off of a user inputted zipcode (this is for a chain of diners) what it will do is take the inputted zipcode, and based off the database, will do the math to figure out what is closer and then send you to mapquest.

Thanks

Dino
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what specific parts do you need guidance with?
dino3
Forum Newbie
Posts: 9
Joined: Mon Jan 17, 2005 12:22 am
Location: winterpark Fl

what I dont understand

Post by dino3 »

[<?php
$Mlink = "";

;
$zip = trim($zip);



$Mlink = "http://www.mapquest.com/maps/map.adp?ad ... =us&zoom=5";


return $Mlink;
}
?>

is what I have (I found it online and been playing around with it)
, I have tired using html to have it link after putting in a zipcode, but nothing happens.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$Mlink does not reference $zip anywhere in it's string.
dino3
Forum Newbie
Posts: 9
Joined: Mon Jan 17, 2005 12:22 am
Location: winterpark Fl

thanks

Post by dino3 »

I cant believe I missed that, ilike I said, I found some old code,

Thanks again Mate

dino
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the (hopefully) less bleary eyes of another developer almost always help.. :) Glad it was an easy one.. so far :D :lol:
dino3
Forum Newbie
Posts: 9
Joined: Mon Jan 17, 2005 12:22 am
Location: winterpark Fl

Here is what I have so far

Post by dino3 »

I am sorry to be taking up your time mate, but here is what I have so far...

[<form>
<h1> Zip Code</h1>
<form name= "zip" id"zip"
method="zip" action="zips.php">


<p>Please insert your Zip Code <br />
<textarea name="Zips" cols "10"
rows="0"id= "$zip"></textarea>
</p>




$Mlink = "";

;
$zip = trim($zip);



$Mlink = "http://www.mapquest.com/maps/map.adp?address=$zip";


return $Mlink;
}

</form>
]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the basic html should look this (zips.php):

Code: Select all

<?php

if(!isset($_GET&#1111;'zip']) || !is_numeric($_GET&#1111;'zip']))
&#123;
echo <<<STOP
<form method="get" action="zips.php">
<input type="text" name="zip" maxlength="5" />
<input type="submit" value="Find Closest Store" />
</form>
STOP;
exit;
&#125;

// do your distance calculations in here
// assume $zip is the location chosen from the calculation

$Mlink = 'http://www.mapquest.com/maps/map.adp?address=' . $zip;

echo 'Closest found: <a href="' . $Mlink . '">' . $zip . '</a>';
dino3
Forum Newbie
Posts: 9
Joined: Mon Jan 17, 2005 12:22 am
Location: winterpark Fl

Life saver

Post by dino3 »

Thank you so much man, you have no Idea how much you have helped me,

dino
Post Reply