View Single Post
Old 09-28-2010, 11:50 PM   #1 (permalink)
bigcougar
The Visitor
Newcomer 
 
Join Date: Sep 2010
Posts: 1
Thanks: 0
bigcougar is on a distinguished road
Default Passing a variable from JavaScript to PHP

Here is my little problem.

I have this page:

http://www.troutsalmonchar.com/ART_BC_LKS_Horseshoe.php

If you click on the map , you will see the name the php file and the parameter (variable) that I am trying to pass on to it.

The idea is that the drop down menu will be populated with data from the server based on this filtering parameter.

Here is my php file

Code:
<?php
$link = mysql_connect('server', 'user', 'password'); 
if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
if(!mysql_select_db(julesjelez_IC_20100723_183411))
    die ("Error selecting db:".mysql_error());
echo $_REQUEST[area];
$area = $_REQUEST['area'];
$result=@mysql_query("SELECT ID, W_Name from Streams_Lakes WHERE W_Country=$area");

if (!$result)
	die("Error retrieving customer from database.");
while ($row=mysql_fetch_array($result)) {
	echo $row["ID"]."\n".
		$row["W_Name"];
}


?>
Do you see my mistake? The JavaScript request function seems to work OK, as well as the connection to the server.
bigcougar is offline  
Reply With Quote