raj_2006 Posted February 28, 2006 Share Posted February 28, 2006 Hi All,I am giving the code here.There is currently four fields.And those four fields is under a while loop and will be generated more if there is more than one record Mysql Db.I have separated the field names by setting the fieldname.oid.oid is the unique idCode://fetching the form values:foreach($_POST as $k => $v){echo "$k: $v<br />\n";}$sql="select * from ord_details where ord_val='$csesid'";$q=mysql_query($sql) or die(mysql_error());$tot=mysql_num_rows($q);while($row=mysql_fetch_array($q)){$oid=$row['oid'];//echo "update ord_details set desexed='$desexed',vac='$vac',mcno='$mcno',acquire='$acquire',condition='$condition',treat='$treat' where oid='$oid'";//echo "update ord_details set treat='$treat' where oid='$oid'";}<form name="f" method="post" action=""><?//FETCHING THE VALUES FROM ORD_DETAILS TABLE $s="select * from ord_details where ord_val='$csesid'";$q_d=mysql_query($s) or die(mysql_error());while($row=mysql_fetch_array($q_d)){$oid=$row['oid'];$pet_name=$row['pet_name'];$pet_species=$row['pet_species'];$pet_breed=$row['pet_breed'];$coverage=$row['coverage'];$benefit=$row['benefit'];$ref_code=$row['ref_code']; $age=$row['age'];$tfcost=$row['tfcost'];$tmcost=$row['tmcost'];$tacost=$row['tacost'];?><table width="98%" cellpadding="3" cellspacing="0"><tr> <td colspan="4" align="left"> </td></tr><tr> <td colspan="4" class="Subtitle" align="left">Pet Details for <?=$pet_name;?></td></tr><tr> <td colspan="4"> </td></tr><tr> <td width="19%" class="Subtitle">Desexed:</td><td width="37%"> <select name="desexed[]"><select name="<?=desexed.$oid;?>"><option value="Yes">Yes</option><option value="No">No</option></select></td><td width="18%" class="Subtitle">Date of Last Vaccination<font color="#CC3300">:</font></td><td width="26%"> <input type="text" name="<?=vac.$oid;?>"></td></tr><tr> <td width="19%" class="Subtitle">Microchip No: </td><td width="37%"> <input type="text" name="<?=mcno.$oid;?>"></td><td colspan="2" class="Subtitle">Did you acquire this pet from the RSPCA? <select name="<?=acquire.$oid;?>"><option value="Yes">Yes</option><option value="No">No</option></select></td></tr><tr> <td colspan="4" class="Subtitle" align="left" valign="top">Condition </td></tr><tr> <td colspan="4" align="left" valign="top"> <textarea name="<?=condition.$oid;?>" cols="35" rows="10"></textarea></td></tr><tr> <td colspan="4" class="Subtitle" align="left" valign="top">Recent Treatment</td></tr><tr> <td colspan="4" align="left" valign="top"><textarea name="<?=treat.$oid;?>" cols="35" rows="10"></textarea></td></tr></table><? } ?><input type="submit" name="continue4" value="Continue" class="button"><input type="hidden" name="oid" value="<?=id.$oid;?>" class="button"></form>Say there is total 2 records whose oid is 34 and 35.Now i want to fetch the form values first and then update the mysql db with the form values according to the oid i have got.But how can i separate the form values or separate oid.Any suggestions plz.........thanks....Raj Quote Link to comment https://forums.phpfreaks.com/topic/3759-form-values-posting-problem-through-php/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.