Jump to content

created a search that doesn't work - need help - again


kevinritt

Recommended Posts

I created a search box on the admin section for people to search for records. Here's the code:

<form action="./includes/update2.php?action=searchlastname" method="post"> 
     Enter a last name: <input type="text" name="lastName" /><br />  
    <input type="submit" name="submit" value="Submit" /> 
   </form>

and here's the case:

case 'searchlastname':
$lastName = mysql_real_escape_string($_POST[’lastName’]);
$sql = mysql_query("SELECT * FROM memberships WHERE lastName='$lastName'");   
// start the while statement to get results from database

while ($row = mysql_fetch_array($sql)) {
// foreach row in the while loop..
foreach($row as $key=>$value){
// 
$$key = ValidateOutput($value);
}
// display data in an HTML table for viewing

echo '<table width="400" align="center" cellpadding="4" cellspacing="1">
<tr>
<td class="display"><a href="../admin/includes/update2.php?action=editmembers&edit=edit&memberID='.$memberID.'">'.$memberID.'</a></td>
<td width="150px" class="display">'.$firstName.' '.' '.$lastName.'</td>
<td class="display">'.$firstName2.' '.' '.$lastName2.'</td>
<td width="300px" class="display">'.$address.' <br> '.$city.' '.' '.$state.' '.' '.$zip.'</td>
<td width="200px" class="display">'.$telephone.'</td>
<td class="display"><a href="mailto:'.$email.'">'.$email.'</a></td>
<td class="display">'.$expiration.'</td>
<td class="display">'.$type.'</td>
<td width="150px" class="display">'.$childName.'</td>
<td class="display">'.$interests.'</td>
<td width="200px" class="display">'.$dateAdded.'</td>
<td width="150px" class="display">'.$updated.'</td>
<td class="display">'.$additionalNotes.'</td>
</tr>
</table>';
}
break;

I've been trying different things but all I get is a blank page.

Archived

This topic is now archived and is closed to further replies.

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