I am doing a student registration form using html and php.
First you will be asked to insert your name, password and email address, and when you click the "Submit" button, you will be redirected to another page ( ChooseDepartment.php
) where you will receive a list of all departments from my database to select your own.
Now, I'm a complete newbie, so here is the part of my PHP code that I stuck in SelectDepartment.php:
$ShowPossibleDep = mysql_query("SELECT NAME,DEPT_ID FROM DEPARTMENT");
if(mysql_num_rows($ShowPossibleDep) > 0){
echo "<br />"."Available departments: "." ".mysql_num_rows($ShowPossibleDep)."<br />";
echo "<br />";
echo '<form id = "dept" action = "Courses.php" method = "post">';
while($row = mysql_fetch_array($ShowPossibleDep))
{
echo $row['NAME'];
echo '<input type="radio" name="department" value=<?php $row['DEPT_ID'] ?>>';
echo "<br />";
}
echo '<input type = "submit" value = "Submit" id = "submitDepartment">';
echo </form>;
}
I am trying to make a switch value to transfer the value of the department ID, so I can update my database with the student department, which is currently NULL
, but I canβt figure out how to use both html and php correctly on the same line! This gives me a syntax error!