hi all,
i am not getting inserted the dropdown value to the back end except that everything is inserting. so can u please help me.
<?php
ob_start();
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid,$projectid);
$con=mysql_connect("10.70.1.50","invensis","invensis");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_myproject",$con);
$sql="SELECT projectname from projects where createdby='$_SESSION[username]'";
mysql_error();
$result=mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result))
{
$id=$row["projectid"];
$projectname=$row["projectname"];
$options.="<option value=\"$id\">".$projectname.'</option>';
}
$sql2="SELECT * FROM users where reportingto='$_SESSION[username]' and role='2'";
mysql_error();
$result2=mysql_query($sql2);
$num=mysql_num_rows($result2);
?>
<head>
<body>
<form action="projectassign.php" method="post">
<table width="100%">
<tr><td> <img src="Logofinalcopy.gif">
</td></tr>
<tr>
<td bgcolor="aqua"><h2>Project assign</h2></td>
</tr></table>
<br>
<table align="center">
<tr>
<td>projectassign</td>
<td><select name="id">
<option value="<?echo '$projectassign';?>" >----select project----<?=$options?>
</select>
</td>
</tr>
</table>
<br><br><br>
<table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px">
<tr>
<th></th>
<th>userid</th>
<th>username</th>
</tr>
<?php
$sno=1;
while($row=mysql_fetch_array($result2, MYSQL_ASSOC)){
?>
<tr>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $row['userid']; ?>"></td>
<td><? echo $row['userid']; ?></td>
<td><? echo $row['username'];?></td>
</tr>
<?php
$sno=$sno+1;
}
?>
</table>
<?php
if(isset($_POST['Submit']))
{
$checkbox=$_POST['checkbox'];
for($i=0;$i<count($checkbox);$i++)
{
$del_id = $checkbox[$i];
$sql = "Insert into projectassign(projectassign,userid,assigneddate)values('$_POST[projectassign]','$del_id','')";
mysql_error();
$result = mysql_query($sql);
}
}
?>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</head>