swatisonee Posted June 10, 2010 Share Posted June 10, 2010 hi, i have a questionnaire form which has 10 fields. F1 : Date, F3-F5 :Name,City,Co( using a self submitting form), then the main form starts for the other fields. Now, since Date is outside of this main form , how do i pass the date value into the script in order for its value to get reflected when the form is processed . For a variety of reasons I cannot put the date field at the bottom . <? header("Cache-Control: public"); include ("../logindl.php"); //db info for DB2 if(!isset($_SESSION['userid'])) { echo "<center><font face='Calibri' size='2' color=red>Sorry, Please login and use this page </font></center>"; exit;} $userid = $_SESSION['userid']; ?> <html> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=Generator content="Microsoft Word 11 (filtered)"> <title>QNAIRE</title> <SCRIPT language=JavaScript> function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='view_enqs.php?cat=' + val ; // this is the form to select from 2 dropdowns } </script> </head> <script type="text/javascript" src="../datepicker/datetimepicker_css.js"></script> // this comes after the head - it doesnt work if its within the head UID: <input type=text name="uid" size=8 value="<? echo $userid ?>"> <input type=text name="uid" size=8 value="<? echo $userid ?>" disabled="true"></a> Date: <input type=text name="meetdate" size="12"> <a href="javascript:NewCssCal('meetdate', 'yyyymmdd')"> <img src="../datepicker/images/cal.gif" width="16" height="16" alt="Pick a date"></a> Company: <? @$cat=$_GET['cat']; // Use this line or below line if register_global is off if(strlen($cat) > 0 and !is_numeric($cat)){ // to check if $cat is numeric data or not. echo "Data Error"; exit; } $quer2=mysql_query("SELECT DISTINCT `Company`,`CID` FROM `Customers` ORDER BY `Company` asc "); if(isset($cat) and strlen($cat) > 0){ $quer=mysql_query("SELECT DISTINCT `CITYID` FROM `Custaddress` WHERE `CID`= $cat ORDER BY `CITYID` asc"); $quer3=mysql_query("SELECT `Lastname` FROM `Custcontact` WHERE `CID`= $cat ORDER BY `Lastname` asc"); } else{$quer=mysql_query("SELECT DISTINCT `CITYID` FROM `Custaddress ORDER BY `CITYID` asc"); $quer3=mysql_query("SELECT `Lastname` FROM `Custcontact` ORDER BY `Lastname` asc"); } ?> <form enctype= 'multipart/form-data' method= 'post' action='view_enqs1.php?userid=<? echo $userid ?>&cat=<? echo $cat?>'> // this is the main form but it doesnt pickup the data of "meetdate" even if if add it in form action as &meetdate= <? echo meetdate ?> <? echo "<select name='cat' onchange=\"reload(this.form)\"><option value=''>Select one</option>"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['CID']==@$cat){echo "<option selected value='$noticia2[CID]'>$noticia2[Company]</option>"."<BR>";} else{echo "<option value='$noticia2[CID]'>$noticia2[Company]</option>";} } echo "</select>"; echo "<select name='subcat'><option value=''>Select one</option>"; while($noticia = mysql_fetch_array($quer)) { $cityid= $noticia['CITYID']; $sql3 =" SELECT * FROM Cities WHERE CITYID = $cityid "; $result3 = mysql_query( $sql3 ) or die (mysql_error()); $myrow3 = mysql_fetch_array($result3); $city = $myrow3['City']; echo "<option value='$myrow3[City]'>$myrow3[City]</option>"; } echo "</select>"; echo "<select name='subcat2'><option value=''>Select one</option>"; while($noticia3 = mysql_fetch_array($quer3)) { echo "<option value='$noticia3[Lastname]'>$noticia3[Lastname]</option>"; } echo "</select>"; ?> Misc<input type="text" size="10" name="misc"></a> SP<input type="text" size="10" name="sp"></a> // and other fields <input name='submit' type='submit' value='ADD'></a> </table> <input type="hidden" name="meetdate" value="<? echo $meetdate ?>"> // this value doesnt get carried. </form> // end of main form </body> </html> Link to comment https://forums.phpfreaks.com/topic/204358-passing-external-data-from-outside-a-form/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.