Jump to content

raj_2006

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

raj_2006's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 id Code: //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">&nbsp;</td> </tr> <tr> <td colspan="4" class="Subtitle" align="left">Pet Details for <?=$pet_name;?> </td> </tr> <tr> <td colspan="4">&nbsp; </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
  2. Hi All... I am giving the code snippet here in javascript and html.The object of this code is to change/display the cell values upon selecting a radio button. [b]//code starts[/b] <script language="JavaScript" type="text/javascript"> <!-- function switchPayment(value) { for(i=0;i<100;i++) { var objM = document.getElementById("monthly"+i); var objA = document.getElementById("annuall"+i); if(objA) { if(value=="m") { if(i!=0) { objM.style.color = "#000000";//on text color objM.style.backgroundColor = "#EFEEB5";//on background color objA.style.color = "#FFFFFF";//off text color objA.style.backgroundColor = "#FFFFFF";//off background color } else { objM.style.backgroundColor = "#EFEEB5";//on background color objA.style.backgroundColor = "#DBDAA4";//off background color } } else { if(i!=0) { objM.style.backgroundColor = "#FFFFFF";//off background color objM.style.color = "#FFFFFF";//off text color objA.style.backgroundColor = "#EFEEB5";//on background color objA.style.color = "#000000";//on text color } else { objM.style.backgroundColor = "#DBDAA4";//on background color objA.style.backgroundColor = "#EFEEB5";//off background color } } } else { break; } } } [b]//HTML starts:[/b] <tr> <td id="monthly0" align="center" onClick="switchPayment('m');document.f.payment_freq[0].checked=true;" style="font-size:11px;background-color:#EFEEB5;">Monthly*<br> <input type="radio" name="payment_freq" value="M" onClick="switchPayment('m');" checked> </td> <td id="annuall0" align="center" onClick="switchPayment('a');document.f.payment_freq[1].checked=true;" style="font-size:11px;background-color:#EFEEB5;">Annual<br> <input type="radio" name="payment_freq" value="A" onClick="switchPayment('a');"> </td> </tr> <td id="monthly1" align="center" style="background-color:#EFEEB5;">$17.33</td> <td id="annuall1" align="center" style="color:#FFFFFF;">$208.00</td> </tr> <tr> <td id="monthly2" align="center" style="background-color:#EFEEB5;padding-top:15px;"> <td id="annuall2" align="center" style="color:#FFFFFF;padding-top:15px;"> </tr> <tr> <td id="monthly3" align="center" style="background-color:#EFEEB5;"> <td id="annuall3" align="center" style="color:#FFFFFF;"> </tr> [b]//code ends[/b] Now what i want is to set the value of td id automatically.means here i am setting manually 1,2,3 besides monthly and annually.but these values has to be dynamic.because when there is 3 rows it is working fine.but after 1st 3 rows when the other rows are generating(due to while loop for mysql resultset) then the td id values are again setting as monthly1...monthly2...monthly3 as so on.But it should be like this monthly4...monthly5 and monthly6. Please dont mind for this long typing and hope you will understand by this......Please suggest what to do. Thanks Raj
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.