I use this code. It works correctly before I made minor changes, I mean, make other input fields and the table field name in mysql but I have some problems from line 14 onwards. With this code I Show some data from database table in a form.
can anyone check my code and tell me some tips to solve my problem please?
<?php
require("../../headerloggedin.php");
?>
<div id="content">
hello
<?php
if(!empty($_GET["editid"]) && !empty($_GET["edituserid"]))
{
$applyid = $_GET["editid"];
$idofuser = $_GET["edituserid"];
$idofjobtype = $_GET["editjobtype"];
$idoflocality = $_GET["editlocality"];
$query = "SELECT * FROM applywork, locality, jobtype, seenon WHERE id = $applyid AND userid = $idofuser AND jobtype = $idofjobtype AND applywork.jobtype = jobtype.typeid AND applywork.locality = locality.localityid AND applywork.seenon = seenon.seenid";
$resultset = $db->query($query);
while($row = mysql_fetch_array($resultset))
{
//draw the user edit form
?>
<table>
<form name="vacancies" method="post" action="updateapplication.php">
<input type="hidden" name="editid" value="<?php echo $applyid;?>"/>
<input type="hidden" name="idofuser" value="<?php echo $idofuser;?>"/>
<input type="hidden" name="idofjobtype" value="<?php echo $idofjobtype;?>"/>
<input type="hidden" name="idoflocality" value="<?php echo $idoflocality;?>"/>
<tr>
<td>Vacancy:</td>
<td><input type="text" name="applyfor" value="<?php echo $row["applyfor"]; ?>" /></td>
</tr>
<tr>
<td>Vacancy seen on:</td>
<td>
<select name="seenon">
<option value="<?php echo $row['seenid'];?>" selected="selected"><?php echo $row['seen']?></option>
<?php
$query = "SELECT * FROM seenon";
$result = $db->query($query);
while ($lrow = mysql_fetch_array($result))
{
if($lrow['seenid']!=$row['seenid'])
{
?>
<option value="<?php echo $lrow['seenid'];?>"><?php echo $lrow['seen']?></option> <?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Reference Number:</td>
<td><input type="text" name="refnumber" value="<?php echo $row["refnumber"]; ?>" /></td>
</tr>
<tr>
<td>Job type:</td>
<td>
<select name="typeid">
<option value="<?php echo $row['typeid'];?>" selected="selected"><?php echo $row['type']?></option>
<?php
$query = "SELECT * FROM jobtype";
$result = $db->query($query);
while ($lrow = mysql_fetch_array($result))
{
if($lrow['typeid']!=$row['typeid'])
{
?>
<option value="<?php echo $lrow['typeid'];?>"><?php echo $lrow['type']?></option> <?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Application sent on:</td>
<td><input type="text" name="applicationsent" value="<?php echo $row["applicationsent"]; ?>" /></td>
</tr>
<tr>
<td>Company Name:</td>
<td><input type="text" name="companyname" value="<?php echo $row["companyname"]; ?>" /></td>
</tr>
<tr>
<td>Address 1:</td>
<td><input type="text" name="address1" value="<?php echo $row["address1"]; ?>" /></td>
</tr>
<tr>
<td>Address 2:</td>
<td><input type="text" name="address2" value="<?php echo $row["address2"]; ?>" /></td>
</tr>
<tr>
<td>Locality:</td>
<td>
<select name="localityid">
<option value="<?php echo $row['localityid'];?>" selected="selected"><?php echo $row['locality']?></option>
<?php
$query = "SELECT * FROM locality";
$result = $db->query($query);
while ($lrow = mysql_fetch_array($result))
{
if($lrow['localityid']!=$row['localityid'])
{
?>
<option value="<?php echo $lrow['localityid'];?>"><?php echo $lrow['locality']?></option> <?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Postcode:</td>
<td><input type="text" name="postcode" value="<?php echo $row["postcode"]; ?>" /></td>
</tr>
<tr>
<td>Telephone:</td>
<td><input type="text" name="telephone" value="<?php echo $row["telephone"]; ?>" /></td>
</tr>
<tr>
<td>Website:</td>
<td><input type="text" name="website" value="<?php echo $row["website"]; ?>" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" value="<?php echo $row["email"]; ?>" /></td>
</tr>
<tr>
<td>Notes:</td>
<td><textarea cols="40" rows="5" name="notes" value="<?php echo $row["notes"]; ?>" ><?php echo $row["notes"]; ?>