Jump to content

SQL Select var working in FF but not in IE


MrPen

Recommended Posts

A newbie to PHP and after searching all over for a solution, I'm at my wits end.  I have a LAMP server with the latest versions of PHP/APACHE.  Using a drop-down list from a leading post form page, I'm loading data from a separate MS SQL 2000 database server to display into a table.  However, the data loads fine in Firefox, but not in IE 6,7, nor 8.  The select loads data filtered by the 'location' column.  The $loc var prints fine in the header tag, but does not work in the select.  The result is table headers with no records.  If I replace the $loc var with actual data, it works. I've tried many variations of syntax for the $loc var but to no avail.  Here is the section of code with the select in question:

 

//Connect to the MS SQL database

$dbconnect = mssql_connect($server, $un, $pw);

$dbselect = mssql_select_db($db,$dbconnect);

if(!$dbselect)

{

die('Cannot connect to the database!');

}

 

//Get location from request form

$loc = $_POST['location'];

print "<p class=\"title\"><strong>" . $loc . "</strong></p>";

 

//Select records from the RSVP table

//$locescape = mysql_real_escape_string($loc);

$sql = "SELECT * FROM ersvp WHERE location='$loc' AND inputdt >= 'July 1, 2008'";

$rs = mssql_query($sql);

if (!$rs)

{

exit("Error in SQL");

}

 

//Set up data table header

echo "<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" align=\"center\" width=\"800\"><tr>";

echo "<th>Customer No</th>";

echo "<th>Name</th>";

echo "<th>School</th>";

echo "<th>Date Registered</th></tr>";

 

//Display data records

while ($nt=mssql_fetch_array($rs))

{

echo "<td>" . $nt['schoolid'] . "</td>";

echo "<td>" . $nt['name'] . "</td>";

echo "<td>" . $nt['schoolname'] . "</td>";

echo "<td>" . $nt['inputdt'] . "</td></tr>";

}

echo "</table>";

 

Any help would be greatly appreciated!!

Link to comment
Share on other sites

Thanks for responding!  $_POST['location'] grabs the value of the drop down combo box from the previous form and passes it to this page. Again, it displays the value of $_POST['location'] in a header tag, but it doesn't work in the SQL select when viewed in ie.

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.