Jump to content

lonkarprajakta29

Member
  • Posts

    5
  • Joined

  • Last visited

lonkarprajakta29's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. i have crated nw topic as u said ben...but m nt getting proper respons..u pls take a luk at that topic...else just suggest me simple editing code for drop down list.its very urgent
  2. <?php include "../includes/drop.php"; include_once "common.php"; _checkSession(); //include "includes/function.php"; function renderForm($srno,$mou,$name,$day,$date,$coord,$client,$tel,$mob,$fb,$sex,$sell,$firstadvance,$balreceived,$shootreceived,$rolls,$cheque,$shootdate,$postshoot,$error) { $result=mysql_query("SELECT day,date,sex,rolls,shootdate,postshoot FROM shoot_details WHERE Sr_no=$srno"); ?> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <link href="emp.css" rel="stylesheet" type="text/css"> <title>MOU Entry</title> </head> <body> <br> <table width="778" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td></td> </tr> <tr> <td> <form method=post action="" > <input type="hidden" name="Sr_no" value="<?php echo $srno?>"> <table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#CCCCCC"> <tr> <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr bgcolor="#F2FECD"> <td height="20" colspan="2" class="blue_links1"> Memorandum Of Understanding(MOU) </td> </tr> <tr> <td colspan="2" class="form_text"><img src="images/spacer_gray11.jpg" width="100%" height="1"></td> </tr> <tr> <td class="form_text"> </td> <td> </td> </tr> <tr> <td height="30" class="txt1"> MOU no</td> <td height="30" class="txt1"> <input name="mou" type="text" class="form1" size="30" value="<?php echo $mou?>"> </td> </tr> <tr> <td height="30" class="txt1"> Name</td> <td height="30" class="txt1"> <input name="name" type="text" class="form1" size="30" value="<?php echo $name?>"> </td> </tr> <tr> <td height="30" class="txt1"> Day</td <td height="30" class="txt1"> </select><?php drop("arr_day","$day");?> </td> </tr> <tr> <td height="30" class="txt1"> Date </td> <td height="30" class="txt1"><?php drop("arr_date",$datearr[2],"sign_date" );?><select name="sign_month" class="form1"><option value="">-Select-</option> <option value="01"<?php if ($datearr[1]=="01") echo "selected";?>>January</option> <option value="02"<?php if ($datearr[1]=="02") echo "selected";?>>February</option> <option value="03"<?php if ($datearr[1]=="03") echo "selected";?>>March</option> <option value="04"<?php if ($datearr[1]=="04") echo "selected";?>>April</option> <option value="05"<?php if ($datearr[1]=="05") echo "selected";?>>May</option> <option value="06"<?php if ($datearr[1]=="06") echo "selected";?>>June</option> <option value="07"<?php if ($datearr[1]=="07") echo "selected";?>>July</option> <option value="08"<?php if ($datearr[1]=="08") echo "selected";?>>August</option> <option value="09"<?php if ($datearr[1]=="09") echo "selected";?>>September</option> <option value="10"<?php if ($datearr[1]=="10") echo "selected";?>>October</option> <option value="11"<?php if ($datearr[1]=="11") echo "selected";?>>November</option> <option value="12"<?php if ($datearr[1]=="12") echo "selected";?>>December</option> </select> <?php drop("arr_year",$datearr[0],"sign_year");?> <font face="Verdana, Arial, Helvetica, sans-serif" size="-2">(DD/MM/YYYY)</font> </tr> <tr> <td height="30" class="txt1"> Co-Ordinator Name</td> <td height="30" class="txt1"> <input name="coord" type="text" class="form1" size="30" value="<?php echo $coord?>"> </td> </tr> <tr> <td height="30" class="txt1"> Client's Name</td> <td height="30" class="txt1"> <input name="client" type="text" class="form1" size="30" value="<?php echo $client?>"> </td> </tr> <tr> <td height="30" class="txt1"> Telephone No.</td> <td height="30" class="txt1"> <input name="tel" type="text" class="form1" size="30" value="<?php echo $tel?>"> </td> </tr> <tr> <td height="30" class="txt1"> Mobile No.</td> <td height="30" class="txt1"> <input name="mobile" type="text" class="form1" size="30" value="<?php echo $mob?>"> </td> </tr> <tr> <td height="30" class="txt1"> Feedback</td> <td height="30" class="txt1"><textarea name="fb" cols=23 rows=5 class="form1"><?php echo $fb?></textarea></td> </tr> <tr> <td height="30" valign="top" class="txt1"> Sex</td> <td height="30" class="txt1"> <?php drop("arr_sex","$sex");?> </td> </tr> <tr> <td height="30" class="txt1"> Number Of Rolls</td> <td height="30" class="txt1"> <?php drop("arr_rolls","$rolls");?> </td> </tr> <tr> <td height="30" class="txt1"> Selling Price</td> <td height="30" class="txt1"> <input name="sell" type="text" class="form1" size="30" value="<?php echo $sell?>"> </td> </tr> <tr> <td height="30" class="txt1"> First Advance Received</td> <td height="30" class="txt1"> <input name="firstadvance" type="text" class="form1" size="30" value="<?php echo $firstadvance?>"> </td> </tr> <tr> <td height="30" class="txt1"> On Shoot Received</td> <td height="30" class="txt1"> <input name="shootreceived" type="text" class="form1" size="30" value="<?php echo $shootreceived?>"> </td> </tr> <tr> <td height="30" class="txt1"> Cheque Details</td> <td height="30" class="txt1"><textarea name="cheque" cols=23 rows=5 class="form1"><?php echo $cheque?></textarea></td> </tr> <tr> <td height="30" class="txt1"> Shoot Date</td> <td height="30" class="txt1"> <?php drop("arr_date",$shootarr[2],"shoot_date");?><select name="shoot_month" class="form1"><option value="00">-Select-</option> <option value="01"<?php if ($shootarr[1]=="01") echo "selected";?>>January</option> <option value="02"<?php if ($shootarr[1]=="02") echo "selected";?>>February</option> <option value="03"<?php if ($shootarr[1]=="03") echo "selected";?>>March</option> <option value="04"<?php if ($shootarr[1]=="04") echo "selected";?>>April</option> <option value="05"<?php if ($shootarr[1]=="05") echo "selected";?>>May</option> <option value="06"<?php if ($shootarr[1]=="06") echo "selected";?>>June</option> <option value="07"<?php if ($shootarr[1]=="07") echo "selected";?>>July</option> <option value="08"<?php if ($shootarr[1]=="08") echo "selected";?>>August</option> <option value="09"<?php if ($shootarr[1]=="09") echo "selected";?>>September</option> <option value="10"<?php if ($shootarr[1]=="10") echo "selected";?>>October</option> <option value="11"<?php if ($shootarr[1]=="11") echo "selected";?>>November</option> <option value="12"<?php if ($shootarr[1]=="12") echo "selected";?>>December</option> </select> <?php drop("arr_year",$shootarr[0],"shoot_year");?> <font face="Verdana, Arial, Helvetica, sans-serif" size="-2">(DD/MM/YYYY)</font></td> </tr> <tr> <td height="30" class="txt1"> Postpond Shoot</td> <td height="30" class="txt1"><?php drop("arr_date",$postarr[2],"post_date" );?><select name="post_month" class="form1"><option value="">-Select-</option> <option value="01"<?php if ($postarr[1]=="01") echo "selected";?>>January</option> <option value="02"<?php if ($postarr[1]=="02") echo "selected";?>>February</option> <option value="03"<?php if ($postarr[1]=="03") echo "selected";?>>March</option> <option value="04"<?php if ($postarr[1]=="04") echo "selected";?>>April</option> <option value="05"<?php if ($postarr[1]=="05") echo "selected";?>>May</option> <option value="06"<?php if ($postarr[1]=="06") echo "selected";?>>June</option> <option value="07"<?php if ($postarr[1]=="07") echo "selected";?>>July</option> <option value="08"<?php if ($postarr[1]=="08") echo "selected";?>>August</option> <option value="09"<?php if ($postarr[1]=="09") echo "selected";?>>September</option> <option value="10"<?php if ($postarr[1]=="10") echo "selected";?>>October</option> <option value="11"<?php if ($postarr[1]=="11") echo "selected";?>>November</option> <option value="12"<?php if ($postarr[1]=="12") echo "selected";?>>December</option> </select> <?php drop("arr_year",$postarr[0],"post_year");?> <font face="Verdana, Arial, Helvetica, sans-serif" size="-2">(DD-MM-YYYY)</font> </td> </tr> <tr> <td colspan="2" valign="top" class="form_text" align="center"><br> <input name="submit" type="submit" class="form1_bu" value="Register Me" ID="Submit1" onClick="return validate();"> <input name="back" type="button" class="form1_bu" onclick="history.back();" value="Back"> </td> </tr> <tr> <td colspan="2" valign="top" class="form_text" align="center"> </td> </tr> </table></td> </tr> </table> <input type="hidden" name="action" value="<?php echo $action;?>"> <input type="hidden" name="Sr_no" value="<?php echo $srno;?>"> </form> </td> </tr> </table> </body> </html> <?php } // check if the form has been submitted. If it has, process the form and save it to the database if (isset($_POST['submit'])) { // confirm that the 'id' value is a valid integer before getting the form data if (is_numeric($_POST['Sr_no'])) { // get form data, making sure it is valid $srno = $_POST['Sr_no']; $mou = mysql_real_escape_string(htmlspecialchars($_POST['mou'])); $name = mysql_real_escape_string(htmlspecialchars($_POST['name'])); $day = mysql_real_escape_string(htmlspecialchars($_POST['day'])); $date=mysql_real_escape_string(htmlspecialchars($_POST['sign_year']))."-".mysql_real_escape_string(htmlspecialchars($_POST['sign_month']))."-" .mysql_real_escape_string(htmlspecialchars($_POST['sign_date'])); $coord = mysql_real_escape_string(htmlspecialchars($_POST['coord'])); $client = mysql_real_escape_string(htmlspecialchars($_POST['client'])); $tel = mysql_real_escape_string(htmlspecialchars($_POST['tel'])); $mob = mysql_real_escape_string(htmlspecialchars($_POST['mob'])); $fb = mysql_real_escape_string(htmlspecialchars($_POST['fb'])); $sex = mysql_real_escape_string(htmlspecialchars($_POST['sex'])); $rolls = mysql_real_escape_string(htmlspecialchars($_POST['rolls'])); $sell = mysql_real_escape_string(htmlspecialchars($_POST['sell'])); $firstadvance = mysql_real_escape_string(htmlspecialchars($_POST['firstadvance'])); $shootreceived = mysql_real_escape_string(htmlspecialchars($_POST['shootreceived'])); $balreceived = mysql_real_escape_string(htmlspecialchars($_POST['balreceived'])); $cheque = mysql_real_escape_string(htmlspecialchars($_POST['cheque'])); $shootdate = mysql_real_escape_string(htmlspecialchars($_POST['shootdate'])); $postshoot = mysql_real_escape_string(htmlspecialchars($_POST['postshoot'])); if($a=$_POST['firstadvance']||$a=$_POST['shootreceived']) {$balreceived=$sell-$firstadvance-$shootreceived; } // check that firstname/lastname fields are both filled in if ($mou == '') { // generate error message $error = 'ERROR: Please fill in all required fields!'; //error, display form renderForm($srno,$mou,$name,$day,$date,$coord,$client,$tel,$mob,$fb,$sex,$sell,$firstadvance,$balreceived,$shootreceived,$rolls,$cheque,$shootdate,$postshoot, $error); } else { // save the data to the database mysql_query("UPDATE shoot_details SET mou='$mou', day=' $day ', date=' $date', coord=' $coord ', client=' $client ', tel=' $tel . ', mob=' $mob', fb=' . $fb ', sex=' $sex ', sell=' $sell ', firstadvance=' $firstadvance ', balreceived=' $balreceived ', shootreceived=' $shootreceived ',cheque='$cheque', rolls='$rolls', shootdate='$shootdate ', postshoot='$postshoot ' WHERE Sr_no='$srno'") or die(mysql_error()); // once saved, redirect back to the view page // header("Location: view.php"); } } else { // if the 'id' isn't valid, display an error echo 'Error!'; } } else // if the form hasn't been submitted, get the data from the db and display the form { // get the 'id' value from the URL (if it exists), making sure that it is valid (checing that it is numeric/larger than 0) if (isset($_GET['Sr_no']) && is_numeric($_GET['Sr_no']) && $_GET['Sr_no'] > 0) { // query db $srno = $_GET['Sr_no']; $result = mysql_query("SELECT * FROM shoot_details WHERE Sr_no=$srno") or die(mysql_error()); $row = mysql_fetch_array($result); // check that the 'id' matches up with a row in the databse if($row) { // get data from db $srno=$row['Sr_no']; $mou=$row['mou']; $name=$row['name']; $day = $row['arr_day']; $date=$row['date']; $coord=$row['coord']; $client=$row['client']; $tel=$row['tel']; $mob=$row['mobile']; $fb=$row['fb']; $sex=$row['arr_sex']; $sell=$row['sell']; $firstadvance=$row['firstadvance']; $balreceived=$row['balreceived']; $shootreceived=$row['shootreceived']; $rolls=$row['arr_rolls']; $cheque=$row['cheque']; $shootdate=$row['shootdate']; $postshoot=$row['postshoot']; // show form renderForm($srno,$mou,$name,$day,$date,$coord,$client,$tel,$mob,$fb,$sex,$sell,$firstadvance,$balreceived,$shootreceived,$rolls,$cheque,$shootdate,$postshoot,''); } else // if no match, display result { echo "No results!"; } } else // if the 'id' in the URL isn't valid, or if there is no 'id' value, display an error { echo 'Error!'; } } ?>
  3. i have used the code posted in this forum for editing the form so help me for drop down list in reference with earlier code only
  4. hey awsm work....it really helped me a lot...but in this i m facing one problem in edit.php....In my form i have used drop down list. I am not able to retrieve the result of that drop down list while editing the form. When i redirected to edit.php the fields having drop down list show first option in drop down list instead of showing selecting option while adding data...plsss help me in this....should i post my code? i have attached my file where i want to insert this changes...if u r finding this code quite complicated then just help me with simple example suppose i make a drop down menu having value 1, 2, 3, 4, 5, one option can be selected, and selected option is stored in database. now i create an edit page, how do i display the selected value in the menu and other values in drop down, for example, Menu is like Select One 1 2 3 4 5 and i select 3, this 3 is stored in database, now on the edit page i want to show 3 as already selected, something like that.. I will be very thankful, if someone could help by explaining how do i make option 3 as selected.. eg. how i know option 3 is selected and stored in db.
  5. hey awsm work....it really helped me a lot...but in this i m facing one problem in edit.php....In my form i have used drop down list. I am not able to retrieve the result of that drop down list while editing the form. When i redirected to edit.php the fields having drop down list show first option in drop down list instead of showing selecting option while adding data...plsss help me in this....should i post my code?
×
×
  • Create New...