Why isn't my php working?

David

New member
Why isn't it letting me use the variable for the Class Type in the other form field? how do you make it work?



<label for="Class_Type">Class Type:</label>
<select name="Class_Type" id="kind" class="required">
<option value="" selected></option>
<option value="History">History</option>
<option value="English">English</option>
<option value="Science">Science</option>
<option value="Math">Math</option>
<option value="Spanish">Spanish</option>
<option value="PE">PE</option>
<option value="Academic Elective">Academic Elective</option>
</select>
<br />
<label for="Class_Name">Name of Class:</label>
<select name="Class_Name" id="class" class="required">
<php
function list_options(){
$sql = 'SELECT `Class` FROM classes WHERE `type`=$kind';
$result = mysql_query($sql)
while($row = mysql_fetch_array($result)){
$fieldName = $row['field1'];
echo "<option value='$fieldName'>$fieldName</option>";
}
}
<select><?php list_options;?></select>
</select>
<br />
<label for="Class_Name">Name of Class:</label>
<input type="text" name="Class_Name" id="class" class="required">
<span class="example">Modern European Literature</span>
it isn't that it is just that I can't use the value of one field in the form in another and I want to know how to do that in the context of this code.
Now all the code works without any errors but using the value of one field in another isn't working.


<label for="Class_Name">Name of Class:</label>
<select name="Class_Name" id="class" class="required">
<?php
function list_options(){
$sql = 'SELECT `Class` FROM classes WHERE `type`=$kind';
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)){
$fieldName = $row['field1'];
echo "<option value='$fieldName'>$fieldName</option>";
}
}
list_options;?>
</select>
<br />
<label for="Class_Name">Name of Class:</label>
<input type="text" name="Class_Name" id="class" class="required">
<span class="example">Modern European Literature</span>
 
Back
Top