coatse
08-17-2012, 05:23 AM
Hi, I have a form that i want to be able to reload mysql data into it and a user can click the next or previous button to scroll through the data and update it
my form is
<form action="addrest1.php" method="POST">
<table width="264" border="0" cellspacing="2">
<tr>
<td width="180"> </td>
<td width="10"> </td>
<td width="62"> </td>
</tr>
<tr>
<td><label>Resturant Name: </label>
<label for="name"></label>
<input type="text" value="" name="name" id="name"></td>
<td> </td>
<td><input type="submit" name="first5" id="first5" value="ADD"></td>
</tr>
<tr>
<td>Location:
<input type="text" name="location" id="location"></td>
<td> </td>
<td><input type="button" name="first6" id="first6" value="UPDATE"></td>
</tr>
<tr>
<td>Address:
<input type="text" name="address" id="address"></td>
<td> </td>
<td><input type="button" name="first7" id="first7" value="DELETE"></td>
</tr>
<tr>
<td>Email:
<input type="text" name="email" id="email"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Telephone:
<input type="text" name="telephone" id="telephone"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><p>Cuisine Type:
<?php
mysql_connect("localhost", "root", "coatez") or die(mysql_error());
mysql_select_db("restaurant") or die(mysql_error());
$query="SELECT type FROM cuisine_type";
$result = mysql_query($query);
echo '<select name="cuisine_id" id="cuisine_id">';
while($nt=mysql_fetch_array($result)){ //Array or records stored in $nt
echo '<option name="select" value="' . $nt['type'] . '">' . $nt['type'] . '</option>';
/* Option values are added by looping through the array */
}
echo '</select>'; // Closing of list box
?>
</p>
<p><a href="cuisineform.php" target="frame"><input type="button" value="Add new Type"/></a><A HREF="javascript:history.go(0)"><input type="button" value="Refresh List"/></A></p>
<p>
<label for="cuisine_id"></label>
</p>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Signature Dish:
<input type="text" name="signature_dish" id="signature_dish"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Price Range:
<input type="text" name="price_range" id="price_range"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Payment Type:
<input type="text" name="payment_type" id="payment_type"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input type="button" name="first" id="first" value="Prev">
<input type="button" name="first2" id="first2" value="Next"></td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
Thanks
James
:thumbsup::)
my form is
<form action="addrest1.php" method="POST">
<table width="264" border="0" cellspacing="2">
<tr>
<td width="180"> </td>
<td width="10"> </td>
<td width="62"> </td>
</tr>
<tr>
<td><label>Resturant Name: </label>
<label for="name"></label>
<input type="text" value="" name="name" id="name"></td>
<td> </td>
<td><input type="submit" name="first5" id="first5" value="ADD"></td>
</tr>
<tr>
<td>Location:
<input type="text" name="location" id="location"></td>
<td> </td>
<td><input type="button" name="first6" id="first6" value="UPDATE"></td>
</tr>
<tr>
<td>Address:
<input type="text" name="address" id="address"></td>
<td> </td>
<td><input type="button" name="first7" id="first7" value="DELETE"></td>
</tr>
<tr>
<td>Email:
<input type="text" name="email" id="email"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Telephone:
<input type="text" name="telephone" id="telephone"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><p>Cuisine Type:
<?php
mysql_connect("localhost", "root", "coatez") or die(mysql_error());
mysql_select_db("restaurant") or die(mysql_error());
$query="SELECT type FROM cuisine_type";
$result = mysql_query($query);
echo '<select name="cuisine_id" id="cuisine_id">';
while($nt=mysql_fetch_array($result)){ //Array or records stored in $nt
echo '<option name="select" value="' . $nt['type'] . '">' . $nt['type'] . '</option>';
/* Option values are added by looping through the array */
}
echo '</select>'; // Closing of list box
?>
</p>
<p><a href="cuisineform.php" target="frame"><input type="button" value="Add new Type"/></a><A HREF="javascript:history.go(0)"><input type="button" value="Refresh List"/></A></p>
<p>
<label for="cuisine_id"></label>
</p>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Signature Dish:
<input type="text" name="signature_dish" id="signature_dish"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Price Range:
<input type="text" name="price_range" id="price_range"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Payment Type:
<input type="text" name="payment_type" id="payment_type"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input type="button" name="first" id="first" value="Prev">
<input type="button" name="first2" id="first2" value="Next"></td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
Thanks
James
:thumbsup::)