[SOLVED] retreiving mysql data via form problem
Posted: Fri Jul 09, 2004 3:15 pm
I am trying to use a form to be able to search threw a database and pull out info but I cant seem to get it to work.
When I enter data into the form all it does is show the forms page again.
Any help would be nice.
Here is the code from the php form.
Here is the code from the php script
feyd | switched
When I enter data into the form all it does is show the forms page again.
Any help would be nice.
Here is the code from the php form.
Code: Select all
<form method="POST" name="Search by Camnumber" action="prestigedb-searchby.php">
<p class="style2" align="center">
<input name="searchlast" type="text" value="Cam #" size="25" maxlength="12"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>Code: Select all
<?php
$username="username";
$password="password";
$database="database";
$searchlast=$_Post['searchlast'];
mysql_connect('servername',$username,$password) or die("Could not connect to localhost");
@mysql_select_db($database) or die("Unable to select database");
$query="SELECT * FROM userprestige WHERE camnumber='$searchlast'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$firstname=mysql_result($result,$i,"firstname");
$lastname=mysql_result($result,$i,"lastname");
$camnumber=mysql_result($result,$i,"camnumber");
$chapternumber=mysql_result($result,$i,"chapternumber");
$domainnumber=mysql_result($result,$i,"domainnumber");
$date=mysql_result($result,$i,"date");
$description=mysql_result($result,$i,"description");
$category=mysql_result($result,$i,"category");
$generalprestige=mysql_result($result,$i,"generalprestige");
$regionalprestige=mysql_result($result,$i,"regionalprestige");
$nationalprestige=mysql_result($result,$i,"nationalprestige");
echo "<b>Name:$firstname $lastname, Cam#: $camnumber, Chapter#: $chapter, Domain#: $domainnumber, Date: $date, Description: $description, Category: $category, General: $generalprestige, Regonal: $regionalprestige, National: $nationalprestige<br><hr><br>";
$i++;
}
?>feyd | switched
Code: Select all
toCode: Select all
tag.[/color]