homepage Welcome to WebmasterWorld Guest from 54.205.193.39
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Search form is not submitting
ksklos




msg:4592523
 5:28 pm on Jul 12, 2013 (gmt 0)

I have this search form with php script to retrieve the data being searched for. I am Google-learning html and php and got this code from someone else. I have adapted it to my needs and I don't think it is my adaptations. When I select the category and put in my criteria there appears to be no way to submit my inputs.


I need some help figuring out how to submit. Thanks for any help you can give.
Code:
<html>
<head>
<title>Member Lookup</title>
<style type="text/css">
table{
background-color: #FCF;
}
th{
width: 150px;
text-align: left;
}
</style>
</head>

<body>
<h1>Search Membership</h1>

<form method="post" action="Search2.php">
<input type="hidden" name="submitted" value="true" />

<label>Search Category:

<select name="category">
<option value="FName">First Name</option>
<option value="LName">Last Name</option>
<option value="City">City</option>
<option value="State">State</option>
<option value="ChapterName">Chapter Name</option>
<option value="ChapterNumber">Chapter Number</option>
</select>
</label>

<label>Search Criteria: <input type="text" name="criteria /></label>

<input type="submit" />

</form>

<?php

if (isset($_Post['submitted'])) {

//Connect to the database
$include('connect.php');

$category = $_Post['category'];
$criteria = $_Post['criteria'];
$query = "Select * FROM Member WHERE $category = '$criteria'";
$result = mysqli_query($dbcon, $query) or die('Could not connect');

echo "<table>";
echo "<tr><th>Member Number</th><th>First Name</th><th>Laast Name</th><th>Address</th><th>Address2</th><th>City</th><th>State</th><th>Zip</th><th>Phone</th><th>Chapter</th><th>Chapter Number</th></tr>";

while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){

echo "<tr><td>";
echo $row['MemberNumber'];
echo "</td><td>";
echo $row['FName'];
echo "</td><td>";
echo $row['LName'];
echo "</td><td>";
echo $row['Address'];
echo "</td><td>";
echo $row['Address2'];
echo "</td><td>";
echo $row['City'];
echo "</td><td>";
echo $row['State'];
echo "</td><td>";
echo $row['Zip'];
echo "</td><td>";
echo $row['Phone'];
echo "</td><td>";
echo $row['Chapter'];
echo "</td><td>";
echo $row['ChapterNumber'];
echo "</td></tr>";

}

echo "</table>";

}//end of main if statement

?>

</body>
</html>

 

DrDoc




msg:4592565
 7:18 pm on Jul 12, 2013 (gmt 0)

Welcome to WebmasterWorld!

CaSe MaTtErS ... It's
$_POST, not $_Post
lucy24




msg:4592592
 8:40 pm on Jul 12, 2013 (gmt 0)

... and that's all assuming "Search2.php" (again, case sensitive) is the name of the file containing the form.

ksklos




msg:4592606
 10:09 pm on Jul 12, 2013 (gmt 0)

Search2.php is the correct page. I realize that case matters I just don't know what needs to be capitalized and what doesn't. I am still very new at this programming platform. Anyway, I found a missing " and once I corrected it and changed the Post to POST. I now have a submit button but am not getting any data back from the Mysql database. Again no error message, just nothing after the submit.

ksklos




msg:4592644
 1:35 am on Jul 13, 2013 (gmt 0)

I got it worked out. Thanks for your help.

incrediBILL




msg:4592656
 3:26 am on Jul 13, 2013 (gmt 0)

Please share the solution to your problem for others to learn.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved