hi all,
i had a page in which list of images can be seen by selecting some date. so now in that table i am having a dropdown of users. so if i select a user and click submit that username, imagename,size,type should be stored in database,but i cant store in my databse. so can any one help me.
Initially page is(check doc0)
1.after selecting a date my page looks like(check doc1).
2.after selecting a user from dropdown i clicked on submit button, now page appears as (check doc2).
so what i need is when click on submit button all that row should get stored.
<html>
<body>
<link rel="stylesheet" type="text/css" href="css/table.css"/>
<form action="useajax.php" method="post">
<table align="center" id="customers" style="width: 90%">
<tr>
<th>S.no</th>
<th>Imageid</th>
<th>Name</th>
<th>Size</th>
<th>Type</th>
<th>Assigned to</th>
</tr>
<?php
include 'connection.php';
$q=$_GET["q"];
//$query1= mysql_query("select name from users where role in (2,3)");
// mysql_error();
//$result=mysql_query($query1);
//$options="";
//while ($row=mysql_fetch_array($result))
// {
// $assignedto=$row["name"];
// $options.="<option value='".$assignedto."'>".($assignedto == $_POST['assignedto'].'selected="selected"'.'') . $assignedto .'</option>';
//}
$query= mysql_query("SELECT id,imageid,name,size,type from images where uploadeddate='".$q."'");
mysql_error();
$num=mysql_num_rows($query);
if($num==0)
{
echo "<strong style='color:red'><center><h2> NO image uploaded on this date</h2></center></strong> ";
}
else
{
$i=0;
while ($i < $num){
$f1=mysql_result($query,$i,"id");
$f2=mysql_result($query,$i,"imageid");
$f3=mysql_result($query,$i,"name");
$f4=mysql_result($query,$i,"size");
$f5=mysql_result($query,$i,"type");
if($i%2==0)
{
?>
<tr class="">
<td><?php echo $f1;?></td>
<td><?php echo $f2; ?></td>
<td><?php echo $f3; ?></td>
<td><?php echo $f4; ?></td>
<td><?php echo $f5; ?></td>
<td>
<select name="assignedto">
<option value="#"><b>SELECT</b></option>
<option value="sss">sss</option>
<option value="john">john</option>
<option value="jack">jack</option>
<option value="smith">smith</option>
</select>
</td>
</tr>
<?php
}
else
{
?>
<tr class="alt">
<td><?php echo $f1;?></td>
<td><?php echo $f2; ?></td>
<td><?php echo $f3; ?></td>
<td><?php echo $f4; ?></td>
<td><?php echo $f5; ?></td>
<td>
<select name="assignedto">
<option value="#"><b>SELECT</b></option>
<option value="sss">sss</option>
<option value="john">john</option>
<option value="jack">jack</option>
<option value="smith">smith</option>
</select>
</td>
</tr>
<?php
}
$i++;
}
?>
<br></table>
<table align="center">
<input type="submit" name="btn" value="submit">
</table>
<?php
}
if(isset($_POST['btn']))
{
echo "Bingooooooo";
// $sql= mysql_query("INSERT INTO assignwork (imageid,name,size,type,assignedto,assignedby) VALUES ($imageid,$name, $size,$type,$assignedto,$_SESSION[username])");
// $result = mysql_query($sql) or die ("Error in query: $sql. ".mysql_error());
// echo "New record inserted with ID ".mysql_insert_id();
}
?>
</form>
</body>
</html>