Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
course_student table November 05, 2010 10:58AM |
Registered: 14 years ago Posts: 10 Rating: 0 |
Language: PHP<?php //other code //gives me the cid of the course the student selected $cname = $_POST[';cname';]; $cid = $_POST[';cid';]; //insert the new student into database switch ($_GET[';action';]) { case "add": $sql = "INSERT INTO student (sname, init, fname, title, msname, dob, sex, lang, idno, telh, telw, cel, fax, email, address) VALUES (';" . $_POST[';sname';] . "';, ';" . $_POST[';init';] . "';, ';" . $_POST[';fname';] . "';, ';" . $_POST[';title';] . "';, ';" . $_POST[';msname';] . "';, ';" . $_POST[';dob';] . "';, ';" . $_POST[';sex';] . "';, ';" . $_POST[';lang';] . "';, ';" . $_POST[';idno';] . "';, ';" . $_POST[';telh';] . "';, ';" . $_POST[';telw';] . "';, ';" . $_POST[';cel';] . "';, ';" . $_POST[';fax';] . "';, ';" . $_POST[';email';] . "';, ';" . $_POST[';address';] . "';)"; break; } if (isset($sql) && !empty($sql)) { echo "<!--" . $sql . "-->"; $result = mysql_query($sql) or die("Invalid query: " . mysql_error()); //get the new students sno $query = "SELECT max(sno) FROM student "; $result = mysql_query($query) or die(mysql_error()); //insert sno and cid into student_course table $sql = "INSERT INTO course_student (sno, cid, year) VALUES (';" . $_POST[';sno';] . "';, ';" . $_POST[';cid';] . "';, ';2010';)"; $result = mysql_query($sql) or die(mysql_error()); ?> <p align="center"> You have successfully registered as a new student. <br><a href="student_man.php">OK</a> </p> <?php } ?>
Language: PHP//other code <form action="commitstudent.php?action=add&type=student" method="post"> <table border="0" align="center" cellspacing="10" cellpadding="3"> <tr> <td width="50%">Surname</td> <td width="50%"><input type="text" name="sname"></td> </tr> <tr> <td>Initials</td> <td><input type="text" name="init"></td> </tr> <tr> <td>Full First Name</td> <td><input type="text" name="fname"></td> </tr> <tr> <td>Title</td> <td><input type="text" name="title"></td> </tr> <tr> <td>Maiden or previous surname</td> <td><input type="text" name="msname"></td> </tr> <tr> <td>Date of Birth</td> <td><input type="text" name="dob"></td> </tr> <tr> <td>Gender</td> <td><input type="text" name="sex"></td> </tr> <tr> <td>Language for Correspondence</td> <td><input type="text" name="lang"></td> </tr> <tr> <td>Identity Number</td> <td><input type="text" name="idno"></td> </tr> <tr> <td>Home Telephone Code + Number</td> <td><input type="text" name="telh"></td> </tr> <tr> <td>Work Telephone Code + Number</td> <td><input type="text" name="telw"></td> </tr> <tr> <td>Cellphone Number</td> <td><input type="text" name="cel"></td> </tr> <tr> <td>Fax Code + Number</td> <td><input type="text" name="fax"></td> </tr> <tr> <td>E-mail Address</td> <td><input type="text" name="email"></td> </tr> <tr> <td>Postal Address of Student</td> <td><input type="text" name="address"></td> </tr> <tr> <td>Choose a course:</td> <td> <select name="cname" style="width:150px"> <?php $sql = "SELECT cname " . "FROM course ORDER BY cid"; $result = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo ';<option value="'; . $row[';cid';] . ';">'; . $row[';cname';] . ';</option>'; . "\r\n"; } ?> </select> </td> </tr> <tr> <td colspan="2" align="right"> <input type="submit" name="SUBMIT" value="Register"></td> </tr> //other code
Re: course_student table November 05, 2010 11:44AM |
Registered: 13 years ago Posts: 28 Rating: 0 |
Re: course_student table November 05, 2010 12:22PM |
Registered: 14 years ago Posts: 10 Rating: 0 |
Re: course_student table November 05, 2010 01:25PM |
Registered: 14 years ago Posts: 60 Rating: 0 |
Re: course_student table November 05, 2010 01:29PM |
Registered: 14 years ago Posts: 60 Rating: 0 |