Good day fellow programmers, please i need your help. I have a hidden field that holds both the destination and the id of the destination, i need help on how to send both the id and and value of the destination to the database
The code for the form is
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
<table width="489" height="141" align="center" cellpadding="3" cellspacing="3" bordercolor="#B1C3D9" class="textf1">
<tr>
<th height="37" colspan="2" bgcolor="#FFFFFF" scope="col"><table width="466" class="textff">
<tr bordercolor="#75A8C7">
<td width="458" bgcolor="#990100" scope="col"><div align="center"><span class="style94">ADD DESTINATIONS </span>FROM</div></td>
</tr>
</table></th>
</tr>
<tr>
<td width="258" height="5" scope="col"><div align="left"><span class="style103">Select Destination From: </span></div></td>
<td width="206" scope="col"><label>
<div align="left">
<label>
<select name="destinationfrom" id="destinationfrom">
<?php
$query = "SELECT * FROM destinationfrom ORDER BY destination ASC";
$result = mysql_query($query) or die("Error ".mysql_errno().": ".mysql_error()."<br><br>$query");
$index = 0;
while($row = mysql_fetch_assoc($result)) {
$index++;
$var =$row['hiddendestination'];
?>
<option value="<?php echo $row['id'] ?>" selected="selected"><?php echo $row['destination'] ?></option>
<?php }
?>
</select>
</label>
<input name="hiddenid" type="hidden" id="hiddenid" value="<?php echo $row['hiddenid'] ?>" />
<input name="hiddendestinationfrom" type="hidden" id="hiddendestinationfrom" value="<?php echo $row['hiddendestination'] ?>" />
</div>
</label></td>
</tr>
<tr>
<td height="7" scope="col"><div align="left"><span class="style103">Enter Destination To: </span></div></td>
<td scope="col"><div align="left">
<label></label>
<label></label>
<input name="destination" type="text" class="textf1" id="destination"/>
</div></td>
</tr>
<tr>
<th height="7" scope="col"> </th>
<td scope="col"><input name="Submit" type="submit" class="style92" value="Submit" /></td>
</tr>
</table>
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
The form action is done by transactform and the action is
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
<?php
include "function.php";
$error= array();
$destinationfrom=isset($_POST['destinationfrom'])? trim($_POST['destinationfrom']):'';
$destination=isset($_POST['destination'])? trim($_POST['destination']):'';
$var= "select * from destinationfrom where id=$destinationfrom";
if(empty($destination)){
$error[]=urlencode("Field Required!");
}
if(empty($error)){
$query= "insert into destinationto(destinationid,destinationfrom,destination) values('$destinationfrom','$var','$destination')";
}
else {
header('Location:adddestinationto.php?action=adddestinationto'.' &error='.join($error, urlencode('<br>')));
}
if(isset($query)){
$msg="<strong> Destination-to was added successfully... </strong>";
$result= mysql_query($query);
header('Location:adddestinationto.php?action=adddestinationto'.' & error='.$msg);
}
?>
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''