PHP/MySQL Query help...

Hi Guys, I would really appreciate some help if possible. I have a drop down list of locations, and when the user selects one i.e. The Braid, I would like it to pass the value (1) into the variable called $myvariable. From there I call the function test(); where I carry out the query. I would then like to display all the data about all events from the location determined my the user. However it doesnt seem to be working correctly. Have you any ideas? (The idea behind it is to load a new page when the user selects a location and perform the query. That way if the user adds a ticket to their cart, it will re-load the page, and query i think).

Code in events.php

[code]


Search by venue:
The Braid Grand Opera House Lyric Theatre
[/code]

[php]<?php
if (isset($_GET[“location”])) {
$myvariable = $_POST[“location”];
test();
}
?>[/php]

function in functions.php

[php]function test() {
$search_query = mysql_real_escape_string($_POST[$myvariable]);
mysql_query(“SELECT id, name, description, price FROM products WHERE location = '” .$search_query."’");
while ($get_row = mysql_fetch_assoc($get)) {
echo ‘

’ . $get_row[‘name’] . ‘
’ . $get_row[‘description’] . ‘
£’ . number_format($get_row[‘price’], 2) .’ Add

’;
}
}[/php]

[php][/php] should be [php][/php]
and
[php]<?php
if (isset($_POST[“location”])) {
$myvariable = $_POST[“location”];
test();
}
?>[/php]

plus there might be other problems but these are the ones I’ve notice.

Sponsor our Newsletter | Privacy Policy | Terms of Service