Hi All,
I am using mysql to fetch some data and then putting it in the form. And I am doing it several times using for loop in a single form. Now I am not sure how to send data to submit form. Here is the code I am using.
Code: Select all
for($i=0; $i<$proj_users; $i++)
{
echo "<select name='emp_id[]'>";
$result_emp = mysql_query("SELECT * FROM emp_details");
$num_results_emp = mysql_num_rows($result_emp);
for($x=0; $x <$num_results_emp; $x++)
{
$row_emp = mysql_fetch_array($result_emp);
echo "<option value='$i'>".$row_emp['emp_f_name']." ".$row['emp_l_name']."</option>";
}
echo "</select>";
}In other page it is
Code: Select all
for ($i=0; $i< count($_POST['emp_id']); $i++)
{
$emp_id_array = addslashes($_POST['emp_id'][$i]);
}
foreach ($emp_id_array as $value)
{
echo "Value: $value<br />\n";
}Now I am not able to understand where I am wrong. Because it is giving me error.
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\project\page.php on line 38
Do anyone have idea about this.
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: