I’m in a database design course and we have a project to create a Database and forms.
we got a crash course in basic php
My Database has a table called students and one of the fields is gender (also Student ID)
it also has one called dorms that has a field called Config values M(male Only), F(Female Only) or C (Co-Ed)
I’m trying to build a form in php/html that will allow a student to select their dorm.
I can pass the value of the [student id] to get the students gender.
I can then use this [gender] to pass back a list of dorms that are either that persons gender or Co-Ed.
How to I make a form of radio buttons for the person to select their chapter.
Once selection has been made how can I pass those to values to the next form to process…
I’m really stuck.
you can help let me know…I can provide what I’ve tried to do
$thisID=$_REQUEST[‘id’];
$sql = "SELECT Gender FROM Students WHERE S_ID = " . $thisID;
if (!$result = $mysqli->query($sql)) {
echo "Error: SQL Error: ";
echo "Errno: " . $mysqli->errno . “”;
echo "Error: " . $mysqli->error . “”;
exit;
}
$row = $result->fetch_assoc();
$thisGender=$row[“Gender”];
$sql=“SELECT ChName FROM Chapter WHERE (C_ID <> 0) AND ((Config = ‘C’) OR (Config =” . “’” . $thisGender . “’” . “))”;
if (!$result = $mysqli->query($sql)) {
echo "Error: SQL Error: ";
echo "Errno: " . $mysqli->errno . “”;
echo "Error: " . $mysqli->error . “”;
exit;
}
echo "
Select the chapter that you bonded to during your stay here. Please choose wisely!
Please choose one of the Chapters from the following list
\n"; /* Using this Gender return those chapters that single gender based on selected Gender or Co-ed */ echo "\n";while($row = mysqli_fetch_assoc($result))
{
extract ($row);
echo “<input type=‘radio’ name =‘chaptername’ value=’$ChName’ /$ChName\n”;
echo “
\n”;
}
echo "
?>