I want the drop down menu to be populated by the "Breeds" field. Once a breed is selected I want the corresponding "Sizes" and "ID" from that row to be displayed. What is the easiest way to accomplish this. Any help would be greatly appreciated. Thanks so much!
This is within a form and the content of each option's value is the ID for that row, this ID is sent to the next page and can be used in another sql query to display the row you want.
SEE COMMENTS IN PHP CODE BELOW
Code Below:
<select name="car_id" class="searchboxfields">
<option value="">Select... (Leave For No Car)</option>
<option value="">-- Used Cars --</option>
PHP Code:
<?php
include("cms/connect.php"); //connect to database
$sql = "SELECT * FROM tblcar";
//query
$result = mysql_query($sql);
$num = mysql_numrows($result); //number of rows returned
$i = 0; // $i is counter
while ($i < $num) { // while loop goes through each row and extracts, in this case, ref, name (to display) and id (for sending to another page)
//content of each row
$id = mysql_result($result,$i,'id');
$ref = mysql_result($result,$i,'ref');
$name = mysql_result($result,$i,'name');
I tried the code listed, but I think there is a syntax error. I haven't been able to pin point it. All I get is a blank white page. If you could take another look and let me know if I'm doing something wrong. Thanks so much!!