Hi All,
I need your help on below.
I have form which takes a input as LIST or SELECT and should get updated in the DB...
Now my problem is, I have 35 fields which has unique ID. so, As I can not $_post for each feild by it name I have create a while loop by fetching as array & defined input type using if condition on the form....but while post method for getting valuses from DB I want to carry 35 field ID so that i can identify its value for controlling.... But while $_Post I am not able to take all values at one time and make foreach condition.....any help is appreciated...
My code go as below.
PHP Code:
<?php
while($info = mysql_fetch_array( $data ))
{
$input_type=$info['type'];
$proces_type=$info['PROCESS_BAU'];
$id_type=$info['id'];
?>
<tr>
<td><?=$info['id']?></td>
<td><?=$info['PROCESS_BAU']?></td>
<?if ($input_type=='TEXT'){?>
<td>Volumes:<input type='TEXT' name='proces_BAU' size='2'/></td>
<?}else{?>
<td>Task:<select name='proces_BAU'><option>--</option><option>Yes</option><option>No</option></select></td>
<?}
?>
</tr>
<?php } ?>
<tr><td><input type="submit" value="Save"/></td></tr>
</form>
</table>
</div>
<?php
}
?>
PHP Code:
<?php
session_start();
$myusername=$_SESSION['myusername'];
?>
<?
include_once "C:/xampp/htdocs/SAM/include/database.php";
//$process="";
echo $process = $_POST['proces_BAU'];
//foreach($process as $key=>$value)
if(!empty($value)){
$qry = "INSERT INTO daily_tasks_done (`Member_Id`,`Task_Id`,`Value`) VALUES ('".$_SESSION['memberid']."','".$key."','".$value."')";
$result1=mysql_query($qry)or die(mysql_error());
}
//$_SESSION['Notify']['type'] = 'Sucess Message:';
//$_SESSION['Notify']['msg'] = 'shift roaster updated!!!';
//header("location: index.php") or die("record not inserted");
mysql_close();
?>
Regards,
Nani