Hey everyone,
Having a few problems:
- It's not populating the dropdown with all the entries (But in the delete function it is, which is a somewhat copy)
- It doesn't post the Employer name, the result I'm getting is "Editing user: BLANK"
Here is the code:
function JobBoard_admin_edit()
{
echo "<h4> edit </h4>";
?>
<form name="jobboard_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
<?php
echo '<select name="ID">';
$con_edit= mysqli_connect("localhost", "profiled_job","", "profiled_jobboard") or die(mysql_error());
$sql="SELECT ID,Employer FROM details";
$result =mysqli_query($con_edit,$sql);
//$employer_id = $_POST['ID'];
while ($data=mysqli_fetch_assoc($result))
{
echo '<option value ="' . $data['Employer'] . '">'. $data['Employer'] . '</option>';
echo "</select>";
}
echo "<p>";
echo "<input type='submit' value='Update User' name='updateuser'></p>";
echo "</form>";
if(isset($_POST['updateuser']))
{
$emp = $employer_id;
$sql = (mysqli_query($con_edit, "SELECT * FROM details WHERE Employer = '$emp'"));
if($sql)
{
echo "Editing user:" . $emp . "<p>";
}
else
{
echo "Data Not found";
echo $emp;
}
}
}