Jump to content

[SOLVED] POST not working.


EagleAmerican

Recommended Posts

I'm pretty sure the code has nothing to do with it because it works on the other host but not on the new one.. but here it is:

 

search.php

 

<form method="post" action="execute_search.php">
<table width=90% align=center>
<tr><td>Search for Parasite:</td><td><input type="text" name="search" size="60" maxlength="255"></td></tr>
<td></td><td><input type="submit"></td></tr>
</table>
</form>

 

execute_search.php (I get the message "Please go back and enter something to search for." no matter what. Even if I enter a search.

 

<?php

if ($search) // perform search only if a string was entered.
{

$dbcnx = @mysql_connect('', '', '');
if (!$dbcnx) {
   exit('<p>Unable to connect to the ' .
       'database server at this time.</p>');
}

$srch="%".$search."%";
$query = "select * from parasite WHERE parasitename LIKE '$srch'";

$result = mysql_db_query("adaarm_db", $query);

if ($result)
{
echo "Search Results:<br><br>";
echo "<table width=90% align=center border=1><tr>
<td align=center>Name</td>
<td align=center>From</td>
<td align=center>Genre</td>
</tr>";

while ($r = mysql_fetch_array($result)) { // Begin while
$id = $r["id"];
$name = $r["parasitename"];
$from = $r["parasitefrom"];
$genre = $r["parasitegenre"];
echo "<tr>
<td><a href=view.php?id=$id>$name</a></td>
<td>$from</td>
<td>$genre</td></tr>";
} // end while
echo "</table>";
} else { echo "Error 8574"; }
} else {
echo "Please go back and enter something to search for.";
}

?>

Link to comment
Share on other sites

Looks like they have register_globals turned off. You might be able to turn it on in your control panel but you'd be better off rewriting  your script to work without globals. eg $search should be $_POST['search'];

Link to comment
Share on other sites

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.