kevinritt Posted February 19, 2009 Share Posted February 19, 2009 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. Link to comment https://forums.phpfreaks.com/topic/145870-created-a-search-that-doesnt-work-need-help-again/ Share on other sites More sharing options...
blueman378 Posted February 19, 2009 Share Posted February 19, 2009 case 'searchlastname': == case $_POST['searchlastname']; altohugh i would suggest you change your form action to get and change that to $_GET['searchlastname']; otherwise a user cant save that search. Link to comment https://forums.phpfreaks.com/topic/145870-created-a-search-that-doesnt-work-need-help-again/#findComment-765888 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.