Code: Select all
<?php
echo "document.write('<fieldset><legend>GET parameter</legend>');";
foreach($_GET as $i=>$v) {
echo "document.write('$i: $v<br />');";
}
echo "document.write('</fieldset>');";
?>Moderator: General Moderators
Code: Select all
<?php
echo "document.write('<fieldset><legend>GET parameter</legend>');";
foreach($_GET as $i=>$v) {
echo "document.write('$i: $v<br />');";
}
echo "document.write('</fieldset>');";
?>Code: Select all
$dj = $_GET['dj'];
$liveMusic = $_GET['liveMusic'];
$nsArea = $_GET['nsArea'];
$food = $_GET['food'];
$skySport = $_GET['skySport'];
$cocktails = $_GET['cocktails'];
$pool = $_GET['pool'];
$garden = $_GET['garden'];
$lateLice = $_GET['lateLice'];
$kidsZone = $_GET['kidsZone'];
//$query_string = 'foo=' . urlencode($) . '&bar=' . urlencode($bar);
$query_string = 'dj=' . urlencode($dj) . '&liveMusic=' . urlencode($liveMusic)
. '&kidsZone=' . urlencode($kidsZone) . '&lateLice=' . urlencode($lateLice)
. '&nsArea=' . urlencode($nsArea) . '&food=' . urlencode($food)
. '&garden=' . urlencode($garden) . '&skySport=' . urlencode($skySport)
. '&cocktails=' . urlencode($cocktails) . '&pool=' . urlencode($pool);
echo xhtmlheader('Create Pub Crawl', 'KEY', 'map_data2.php?'. htmlentities($query_string), 'mapFunctions.js'); //'map_data.php',Code: Select all
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<SCRIPT language=JavaScript src='map_data2.php?dj=&liveMusic=&kidsZone=true&lateLice=true&nsArea=true&food=&garden=&skySport=&cocktails=&pool= ' ></SCRIPT>
</head>
<body>
test
</body>
</html>GET parameter
dj:
liveMusic:
kidsZone: true
lateLice: true
nsArea: true
food:
garden:
skySport:
cocktails:
i get the correct data sent then. i've already rechecked the php code that generates $filter in a previous backup so i don't know why it causes my script to fail when i include a reference to $filter.GET parameter
dj:
liveMusic:
kidsZone:
lateLice:
nsArea:
food: true
garden:
skySport:
cocktails: true
pool:
Code: Select all
<?php
require_once('common.php');
db_connect();
// remove any harmless run-time notices
// error_reporting(E_ALL ^ E_NOTICE);
// create an array for amenity checkbox names
$chkbox_arr = array ( 'dj', 'liveMusic', 'nsArea','food','skySport', 'cocktails'
,'pool', 'garden', 'lateLice', 'kidsZone' );
// remove any checkboxes from the array which haven't been checked by the user
for ( $i = 0; $i <10; $i++ ) {
$element = $chkbox_arr[$i];
if ( !isset( $_POST[$element] ) ) {
unset( $chkbox_arr[$i] );
}
}
// re-sort the index and count the elements in $chkbox_arr
sort ($chkbox_arr);
$result = count($chkbox_arr);
//add sql code to each element in order to filter by element='y'
for ( $i = 0; $i <$result; $i++ ) {
$chkbox_arr[$i]=' AND Amenities.'.$chkbox_arr[$i]."='y'";
}
// string together all elements in a single string
$sql_str = implode(" ", $chkbox_arr );
// $sql = mysql_query ("select Pubs.pubID from Pubs, Amenities where Pubs.pubID=Amenities.pubID $filter") or die( 'Invalid query: ' . mysql_error() );
// $sql2 = mysql_query ("select Latitude, Longitude, pubName, pubStreetNo, pubStreet, pubCity, pubCounty, pubPostcode, pubPhone from Pubs where Pubs.pubID=Amenities.pubID $filter") or die( 'Invalid query: ' . mysql_error() );
$sql = mysql_query ( " select Latitude, Longitude, pubName, pubStreetNo, pubStreet, pubCity, pubCounty,
pubPostcode, pubPhone from Pubs " ) or die( 'Invalid query: ' . mysql_error() );
$markers = array();
while( $elements = mysql_fetch_array($sql) ) {
$br = '<br>';
$markers[] = '{'
." 'latitude' : " .$elements[0] .','
." 'longitude' : " .$elements[1] .','
." 'name' : '" .$sql_str."'"
// ."'address': '" .$elements[3] .$br .$elements[4] .$br .$elements[5]
// .$br .$elements[6] .$br .$elements[7] ."',"
// ."'phone': '" .$elements[8] ."'"
.'},';
}
//convert array into a single string variable
$markers = implode( ' ', $markers );
//remove the end comma in the string
$markers = substr_replace($markers,"",-1);
$jscript = 'var markers; markers =' .'[' .$markers .'];';
print " alert( '" .$sql_str ."' );";
print $jscript;
?>