<td width="50%" class="path">Student Name
<div class="span12">
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<select name="student_reg" class="chzn-select"required/>
<option></option>
<?php
@$db = mysql_connect("localhost","root","");
mysql_select_db("student",$db);
@$result = mysql_query("select * from admission")or die(mysql_error());
while ($row=mysql_fetch_array($result)){ ?>
<option value="<?php printf ($row['id']); ?>"><?php printf ($row['name']." ".$row['lastname']); ?></option>
<?php } ?>
</select>
</td>
</tr>
<?php
$sub_name = $_POST['sub_name'];
$sub_id = $_POST['sub_id'];
$name = $_POST['name'];
$lastname = $_POST['lastname'];
$id = $_POST['id'];
$sql = mysql_query("insert into load_subject (sub_name,sub_id,name,lastname,id) select ('$sub_name','$sub_id','$name','$lastname','$id')")or die(mysql_error());
if(@mysql_query($sql and $sql2)){
echo"Successful";
}
else{
echo"Error";
}
$sql = "SELECT * from subject INNER JOIN admission";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
?>
<tr align="center">
<td></td>
<td bgcolor="#DDDDDD"><input type="Text" class="textbox1" name="sub_name" size="35" value="<?php printf($row['sub_name']); ?>"></td>
<td bgcolor="#DDDDDD"><input type="Text" class="textbox1" name="sub_id" size="35" value="<?php printf($row['sub_id']); ?>"></td>
<td bgcolor="#DDDDDD"><font face="verdana" style="font-size:12px"></font><input type="submit" value="Submit"/><a class="buttonform"></td>
</form>
</tr>
<?php
}
?>
</table></td>
I encouter with this code problem, trying to get all the data in a form to be inserted into 'load_subject' table.
please help me with this. thank you.