raghavbhat Posted February 19, 2013 Share Posted February 19, 2013 (edited) Hi, I am new to this forum. I am working in a php application in which I should select a Tender from one page and when I click ' upload button' it should divert me to a document repositary and allow me to upload a document for that tender without entering the tender Id. So I am passing the tender Id by means of URL. Once the user successfully uploaded one document it should redirect to same page allowing him to upload more documents. The problem is the next time when it is redirected the Tender Id which I passed the first time is not there and so shows error. Initially the URL is like this http://localhost:89/...add.php?id=1005 Here is my code: 1. I am hiding a cell which was asking 'Number' from user, because now I am passing it dynamically.\ Here itself I am getting the Id from URL. $cellvalue = "<input type=\"hidden\" name=\"add_fd9\" value=\"" . qsreplace_html_quote(stripslashes($_GET["id"])) . "\" size=\"70\" maxlength=\"255\" >"; 2. This is how the page is redirected to the same page after a submit is made. $submiturl = "./documents_add.php?id="; I tried to pass the id like I did before but shows error. I tried $submiturl = "./documents_add.php?id=$_GET["id"])"; I also tried $tenderid==$_GET["id"]); and $submiturl = "./documents_add.php?id="+tenderid; Can any one help me with this. Edited February 19, 2013 by raghavbhat Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/ Share on other sites More sharing options...
greenbman Posted February 19, 2013 Share Posted February 19, 2013 I believe this $submiturl = "./documents_add.php?id=$_GET["id"])"; should be $submiturl = "./documents_add.php?id=".$_GET["id"]; There was a bracket at the end and I believe that you only use + var + in javascript not php. hope this helps, greenbman Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413262 Share on other sites More sharing options...
raghavbhat Posted February 19, 2013 Author Share Posted February 19, 2013 (edited) @greenbman Ok, I did exactly as you suggested now the error has gone. But the second time when it redirects the URL becomes. http://localhost:89/...nts_add.php?id= so now the Tender Id is not available for the user. Is there a way to get the value again. Meaning, the same ID, even after redirection. Edited February 19, 2013 by raghavbhat Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413264 Share on other sites More sharing options...
greenbman Posted February 19, 2013 Share Posted February 19, 2013 I would have to see the rest of the code on the page what triggers the second redirection? Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413266 Share on other sites More sharing options...
greenbman Posted February 19, 2013 Share Posted February 19, 2013 You could use a session. Place this on the first line of code: <?php session_start(); then you can do this: $_SESSION['id'] = $_GET['id']; and when it redirects again: $getID_On_Redirect = $_SESSION['id']; echo $getID_On_Redirect; greenbman Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413267 Share on other sites More sharing options...
greenbman Posted February 19, 2013 Share Posted February 19, 2013 Or: $submiturl = "./documents_add.php?id=".$_SESSION['id']; Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413269 Share on other sites More sharing options...
raghavbhat Posted February 19, 2013 Author Share Posted February 19, 2013 (edited) I will check. Edited February 19, 2013 by raghavbhat Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413270 Share on other sites More sharing options...
raghavbhat Posted February 19, 2013 Author Share Posted February 19, 2013 (edited) No, its loosing the value on the second rediection .Please look at the code where I have removed code as much as possible which does not match our needs. <?php session_start(); $_SESSION['id'] = $_GET['id']; $getID_On_Redirect = $_SESSION['id']; Add Documents </font><hr /></center><br> <A NAME=top></A> <Form name="qs_add_form" method="post" action="./documents_add.php" enctype="multipart/form-data" onsubmit="return qsFormonsubmitController(this)" onreset="return qsPageonresetController(this)" > <?php print $hidden_tag; ?> <Table Border="0" Cellpadding="2" Cellspacing="1" BgColor="#D4D4D4"> <?php $css_class = "\"TrOdd\""; ?> <tr> <td colspan="2" class="ThRows">Add Documents</td> </tr> <?php if ($err_string != "") { print "<tr>"; print "<td class=\"ThRows\"><Strong>Error:</Strong></td>"; print "<td class=" . $css_class . " align=Default>" . $err_string . "</td>"; print "</tr>"; } ?> <tr> <td class="ThRows">*Title</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd10"])) && (!isset($_POST["add_fd10"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd10"); } $cellvalue = "<input type=\"text\" name=\"add_fd10\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" size=\"100\" maxlength= \"255\" >"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> <?php $cellvalue = ""; if ((!isset($_GET["add_fd9"])) && (!isset($_POST["add_fd9"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd9"); } $cellvalue = "<input type=\"hidden\" name=\"add_fd9\" value=\"" . qsreplace_html_quote(stripslashes($_GET["id"])) . "\" size=\"70\" maxlength= \"255\" >"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> <tr> <td class="ThRows">*File (main)</td> <?php $cellvalue = "<input type=\"file\" name=\"upload_fd24\">"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <?php $cellvalue = "<input type=\"hidden\" name=\"add_fd27\" value=\"1\">"; if ($cellvalue == "") { $cellvalue = " "; } print $cellvalue; ?> <?php #----get back url page---- $backurl = "http://localhost:8080/MPCS-war/faces/Tender/tenderStages.xhtml?"; ?> <tr> <td class="ThRows"> </td> <td class="TrOdd" align=Default> <input type="hidden" name="act" value="n"> <input type="button" name="QS_Back" value="Back" onclick="javascript:window.location='<?php print $backurl; ?>'"> <input type="submit" name="QS_Submit" value="Add" onclick="javascript:window.location='<?php print $backurl; ?>'"> <input type="reset" name="QS_Reset" value="Reset"> </td> </tr> </Table><br> </Form> <?php echo $getID_On_Redirect; ?> </BODY> </HTML> Edited February 19, 2013 by raghavbhat Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413275 Share on other sites More sharing options...
greenbman Posted February 19, 2013 Share Posted February 19, 2013 I do not see anywhere on this page that makes it redirect again. Is this the redirected page or the original page? Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413283 Share on other sites More sharing options...
raghavbhat Posted February 19, 2013 Author Share Posted February 19, 2013 no, i am redirecting to the same page.. I am allowing the user to upload documents according to his wish. The requirement the user should be able to upload as much as documents as he wants. Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413320 Share on other sites More sharing options...
raghavbhat Posted February 19, 2013 Author Share Posted February 19, 2013 Ok, sorry , i think i removed the code unknowingly $sql = ""; $sql = "insert into " . $quotechar. mysql_field_table($result,0) . $quotechar; $sql .= " (" . $insert_sql . ")"; $sql .= " values"; $sql .= " (" . $value_sql . ")"; #----get submit url page---- $submiturl = "./documents_add.php?id=".$_SESSION['id']; Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413322 Share on other sites More sharing options...
raghavbhat Posted February 19, 2013 Author Share Posted February 19, 2013 Shall I paste the entire code Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413325 Share on other sites More sharing options...
greenbman Posted February 19, 2013 Share Posted February 19, 2013 Yeah go ahead and post the entire code. It will allow me to see all of it in one piece. Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413439 Share on other sites More sharing options...
raghavbhat Posted February 20, 2013 Author Share Posted February 20, 2013 Please check this. It contains the changes which you told me already. <?php session_start(); $_SESSION['id'] = $_GET['id']; $getID_On_Redirect = $_SESSION['id']; require('qs_connection.php'); require('qs_functions.php'); @session_start(); $row = ""; $err_string = ""; $updateCond = ""; $RDBMS_Type= "MySQL"; //Check security login $pagesecure_level = 4; if (strtoupper(qsrequest("logout"))=="Y") { $_SESSION["UserLevel"] = 0; $_SESSION["Logon"] = "FALSE"; $_SESSION["UserLogon"] = ""; $_SESSION["RedirectURL"] = qssession("firstredirecturl"); header ("Location: ./global_group_login.php"); exit(); } if (qssession("Logon") != "TRUE") { $_SESSION["RedirectURL"] = "./" . rawurlencode("documents_add").".php?" . qsservervars("QUERY_STRING"); header ("Location: ./global_group_login.php"); exit(); } if (qssession("UserLevel") == "") { $_SESSION["UserLevel"] = 0; } if (qssession("UserLevel") < $pagesecure_level) { $_SESSION["Logon"] = "FALSE"; $_SESSION["RedirectURL"] = "./" . rawurlencode("documents_add").".php?" . qsservervars("QUERY_STRING"); include_once('global_group_login.php'); exit(); } if (isset($_GET["page"])) { $current_page = $_GET["page"]; } elseif (isset($_POST["page"])) { $current_page = $_POST["page"]; } else { $current_page = 1; } $quotechar = "`"; $quotedate = "'"; $hidden_tag = ""; $result = ""; $sql = ""; $sql_ext = ""; $formatdate = array(); $formatdate[10] = ""; $formatdate[9] = ""; $formatdate[14] = "yyyy-mm-dd"; $formatdate[11] = ""; $formatdate[12] = ""; $formatdate[13] = ""; $formatdate[1] = ""; $formatdate[2] = ""; $formatdate[3] = ""; $formatdate[4] = ""; $formatdate[5] = ""; $formatdate[7] = ""; $formatdate[6] = "yyyy-mm-dd"; $formatdate[8] = "yyyy-mm-dd"; $formatdate[15] = ""; $formatdate[16] = ""; $formatdate[17] = ""; $formatdate[18] = ""; $formatdate[19] = ""; $formatdate[20] = ""; $formatdate[21] = ""; $formatdate[22] = ""; $formatdate[23] = ""; $formatdate[24] = ""; $formatdate[28] = "mm/dd/yyyy"; $formatdate[29] = "mm/dd/yyyy"; $formatdate[25] = "YYYY-MM-DD HH:nn:ss"; $formatdate[26] = "YYYY-MM-DD HH:nn:ss"; $formatdate[27] = "YYYY-MM-DD HH:nn:ss"; $seperatedate = array(); $seperatedate[10] = " "; $seperatedate[9] = " "; $seperatedate[14] = "-"; $seperatedate[11] = " "; $seperatedate[12] = " "; $seperatedate[13] = " "; $seperatedate[1] = " "; $seperatedate[2] = " "; $seperatedate[3] = " "; $seperatedate[4] = " "; $seperatedate[5] = " "; $seperatedate[7] = " "; $seperatedate[6] = "-"; $seperatedate[8] = "-"; $seperatedate[15] = " "; $seperatedate[16] = " "; $seperatedate[17] = " "; $seperatedate[18] = " "; $seperatedate[19] = " "; $seperatedate[20] = " "; $seperatedate[21] = " "; $seperatedate[22] = " "; $seperatedate[23] = " "; $seperatedate[24] = " "; $seperatedate[28] = "/"; $seperatedate[29] = "/"; $seperatedate[25] = "-"; $seperatedate[26] = "-"; $seperatedate[27] = "-"; $sql .= " Select\n"; $sql .= " documents.`id`,\n"; $sql .= " documents.`main_category`,\n"; $sql .= " documents.`sub_category`,\n"; $sql .= " documents.`originator`,\n"; $sql .= " documents.`copyright`,\n"; $sql .= " documents.`issuer`,\n"; $sql .= " documents.`issued_date`,\n"; $sql .= " documents.`reciever`,\n"; $sql .= " documents.`recieved_date`,\n"; $sql .= " documents.`no`,\n"; $sql .= " documents.`title`,\n"; $sql .= " documents.`revision_prefix`,\n"; $sql .= " documents.`revision_no`,\n"; $sql .= " documents.`revision_suffix`,\n"; $sql .= " documents.`revision_date`,\n"; $sql .= " documents.`volume`,\n"; $sql .= " documents.`volumes`,\n"; $sql .= " documents.`print_size`,\n"; $sql .= " documents.`file_extension`,\n"; $sql .= " documents.`source_file_extension`,\n"; $sql .= " documents.`prepared_by`,\n"; $sql .= " documents.`checked_by`,\n"; $sql .= " documents.`approved_by`,\n"; $sql .= " documents.`remarks`,\n"; $sql .= " documents.`file_name`,\n"; $sql .= " documents.`added_by`,\n"; $sql .= " documents.`added_on`,\n"; $sql .= " documents.`show`\n"; $sql .= " From\n"; $sql .= " documents documents\n"; //Field Related Declarations $req__Title = "add_fd10"; $req_No = "add_fd9"; $req__Revision_date = "add_fd14"; $req_Revision_prefix = "add_fd11"; $req__Revision_no = "add_fd12"; $req_Revision_suffix = "add_fd13"; $req_Main_category = "add_fd1"; $req_Sub_category = "add_fd2"; $req_Originator = "add_fd3"; $req_Copyright = "add_fd4"; $req_Issuer = "add_fd5"; $req_Reciever = "add_fd7"; $req_Issued_date = "add_fd6"; $req_Recieved_date = "add_fd8"; $req_Volume = "add_fd15"; $req_Volumes = "add_fd16"; $req_Print_size = "add_fd17"; $req_File_extension = "add_fd18"; $req_Source_file_extension = "add_fd19"; $req_Prepared_by = "add_fd20"; $req_Checked_by = "add_fd21"; $req_Approved_by = "add_fd22"; $req_Remarks = "add_fd23"; $req__File__main_ = "add_fd24"; $req_File__extention_1_ = "add_fd28"; $req_File__extention_2_ = "add_fd29"; $req_Added_by = "add_fd25"; $req_Added_on = "add_fd26"; $req_Show = "add_fd27"; //Assign Recordset Field Index $rs_idx_id = 0; $rs_idx_main_category = 1; $rs_idx_sub_category = 2; $rs_idx_originator = 3; $rs_idx_copyright = 4; $rs_idx_issuer = 5; $rs_idx_issued_date = 6; $rs_idx_reciever = 7; $rs_idx_recieved_date = 8; $rs_idx_no = 9; $rs_idx_title = 10; $rs_idx_revision_prefix = 11; $rs_idx_revision_no = 12; $rs_idx_revision_suffix = 13; $rs_idx_revision_date = 14; $rs_idx_volume = 15; $rs_idx_volumes = 16; $rs_idx_print_size = 17; $rs_idx_file_extension = 18; $rs_idx_source_file_extension = 19; $rs_idx_prepared_by = 20; $rs_idx_checked_by = 21; $rs_idx_approved_by = 22; $rs_idx_remarks = 23; $rs_idx_file_name = 24; $rs_idx_added_by = 25; $rs_idx_added_on = 26; $rs_idx_show = 27; if (isset($_POST["act"])) { $ProcessForm = "Y"; if ($ProcessForm == "Y") { if (strpos(strtoupper($sql), " WHERE ")) { $sqltemp = $sql . " AND (1=0) "; }else{ $sqltemp = $sql . " Where (1=0) "; } $result = mysql_query($sqltemp . " " . $sql_ext . " limit 0,1") or die("Invalid query"); $qry_string = ""; $insert_sql = ""; $value_sql = ""; $i = 0; $SourceFileUpload = array(); $DestFileUpload = array(); $NewFieldUpload = array(); //Set initial value for array $SourceFileUpload[0] = ""; $DestFileUpload[0] = ""; $NewFieldUpload[0] = ""; $SourceFileUpload[1] = ""; $DestFileUpload[1] = ""; $NewFieldUpload[1] = ""; $SourceFileUpload[2] = ""; $DestFileUpload[2] = ""; $NewFieldUpload[2] = ""; $SourceFileUpload[3] = ""; $DestFileUpload[3] = ""; $NewFieldUpload[3] = ""; $SourceFileUpload[4] = ""; $DestFileUpload[4] = ""; $NewFieldUpload[4] = ""; $SourceFileUpload[5] = ""; $DestFileUpload[5] = ""; $NewFieldUpload[5] = ""; $SourceFileUpload[6] = ""; $DestFileUpload[6] = ""; $NewFieldUpload[6] = ""; $SourceFileUpload[7] = ""; $DestFileUpload[7] = ""; $NewFieldUpload[7] = ""; $SourceFileUpload[8] = ""; $DestFileUpload[8] = ""; $NewFieldUpload[8] = ""; $SourceFileUpload[9] = ""; $DestFileUpload[9] = ""; $NewFieldUpload[9] = ""; $SourceFileUpload[10] = ""; $DestFileUpload[10] = ""; $NewFieldUpload[10] = ""; $SourceFileUpload[11] = ""; $DestFileUpload[11] = ""; $NewFieldUpload[11] = ""; $SourceFileUpload[12] = ""; $DestFileUpload[12] = ""; $NewFieldUpload[12] = ""; $SourceFileUpload[13] = ""; $DestFileUpload[13] = ""; $NewFieldUpload[13] = ""; $SourceFileUpload[14] = ""; $DestFileUpload[14] = ""; $NewFieldUpload[14] = ""; $SourceFileUpload[15] = ""; $DestFileUpload[15] = ""; $NewFieldUpload[15] = ""; $SourceFileUpload[16] = ""; $DestFileUpload[16] = ""; $NewFieldUpload[16] = ""; $SourceFileUpload[17] = ""; $DestFileUpload[17] = ""; $NewFieldUpload[17] = ""; $SourceFileUpload[18] = ""; $DestFileUpload[18] = ""; $NewFieldUpload[18] = ""; $SourceFileUpload[19] = ""; $DestFileUpload[19] = ""; $NewFieldUpload[19] = ""; $SourceFileUpload[20] = ""; $DestFileUpload[20] = ""; $NewFieldUpload[20] = ""; $SourceFileUpload[21] = ""; $DestFileUpload[21] = ""; $NewFieldUpload[21] = ""; $SourceFileUpload[22] = ""; $DestFileUpload[22] = ""; $NewFieldUpload[22] = ""; $SourceFileUpload[23] = ""; $DestFileUpload[23] = ""; $NewFieldUpload[23] = ""; $SourceFileUpload[24] = ""; $DestFileUpload[24] = ""; $NewFieldUpload[24] = ""; $SourceFileUpload[25] = ""; $DestFileUpload[25] = ""; $NewFieldUpload[25] = ""; $SourceFileUpload[26] = ""; $DestFileUpload[26] = ""; $NewFieldUpload[26] = ""; $SourceFileUpload[27] = ""; $DestFileUpload[27] = ""; $NewFieldUpload[27] = ""; $SourceFileUpload[28] = ""; $DestFileUpload[28] = ""; $NewFieldUpload[28] = ""; while ($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result); $field_name = $meta->name; $field_type = $meta->type; $type_field = ""; $type_field = returntype($field_type); if (qsvalidRequest("search_fd" .$i)) { if ($qry_string == "") { $qry_string = "search_fd" . $i . "=" . urlencode(stripslashes(qsrequest("search_fd" . $i))); } else { $qry_string .= "&search_fd" .$i . "=" . urlencode(stripslashes(qsrequest("search_fd" . $i))); } $hidden_tag .= "<input type=\"hidden\" name=\"search_fd" .$i . "\" value=\"" . qsreplace_html_quote(stripslashes(qsrequest("search_fd" . $i))) . "\">\n"; if ($qry_string == "") { $qry_string = "multisearch_fd" . $i . "=" . urlencode(stripslashes(qsrequest("multisearch_fd" . $i))); } else { $qry_string .= "&multisearch_fd" .$i . "=" . urlencode(stripslashes(qsrequest("multisearch_fd" . $i))); } $hidden_tag .= "<input type=\"hidden\" name=\"multisearch_fd" .$i . "\" value=\"" . qsreplace_html_quote(stripslashes(qsrequest("multisearch_fd" . $i))) . "\">\n"; } if (qsvalidRequest("add_fd" . $i)) { $idata = qsrequest("add_fd" . $i); if ($meta) { if ($type_field == "type_datetime") { if ($insert_sql == "") { $insert_sql .= $quotechar . $field_name . $quotechar; $value_sql .= $quotedate . qsconvertdate2ansi($idata,$formatdate[$i],$seperatedate[$i]) . $quotedate; } else { $insert_sql .= "," . $quotechar . $field_name . $quotechar; $value_sql .= "," . $quotedate . qsconvertdate2ansi($idata,$formatdate[$i],$seperatedate[$i]) .$quotedate; } } elseif ($type_field == "type_integer") { $idata = QSConvert2EngNumber($idata); if (is_numeric($idata)) { if ($insert_sql == "") { $insert_sql .= $quotechar . $field_name . $quotechar; $value_sql .= $idata; } else { $insert_sql .= "," . $quotechar . $field_name . $quotechar; $value_sql .= "," . $idata; } } else { $err_string .= "<strong>Error:</strong>while adding<strong>" . $field_name . "</strong>.<br>"; $err_string .= "Description: Type mismatch.<br>"; } } elseif ($type_field == "type_string") { if ($insert_sql == "") { $insert_sql .= $quotechar . $field_name . $quotechar; $value_sql .= "'" . ereg_replace("'","''",stripslashes($idata)) . "'"; } else { $insert_sql .= "," . $quotechar . $field_name . $quotechar; $value_sql .= ",'" . ereg_replace("'","''",stripslashes($idata)) . "'"; } } else { if ($insert_sql == "") { $insert_sql .= $quotechar . $field_name . $quotechar; $value_sql .= "'" . ereg_replace("'","''",stripslashes($idata)) . "'"; } else { $insert_sql .= "," . $quotechar . $field_name . $quotechar; $value_sql .= ",'" . ereg_replace("'","''",stripslashes($idata)) . "'"; } } } } else { if ((strtolower($field_type) != "int identity") && (strtolower($field_type) != "autoincrement") && (strtolower($field_type) != "counter")) { if ($insert_sql == "") { $insert_sql .= $quotechar . $field_name . $quotechar; $value_sql .= "null"; } else { $insert_sql .= "," . $quotechar . $field_name . $quotechar; $value_sql .= ", null"; } } } $i++; } $sql = ""; $sql = "insert into " . $quotechar. mysql_field_table($result,0) . $quotechar; $sql .= " (" . $insert_sql . ")"; $sql .= " values"; $sql .= " (" . $value_sql . ")"; // // Below is the snippet for Submit URL Page #----get submit url page---- $submiturl = "./documents_add.php?id="; if ($result > 0) {mysql_free_result($result);} if (!$result = @mysql_query($sql)){ $err_string .= "<strong>Error:</strong>while adding<br>" . mysql_error(); } else { } //Start update data of upload field $value_sql = ""; $max_id = -1; $max_id = GetLastRecordID($RDBMS_Type, "Direct", "documents", "id", $conn ); $updateCond = ""; $updateCond = "id=". $max_id; if($_FILES['upload_fd24']['name'] != "") { $sql = ""; $sql .= " Select\n"; $sql .= " documents.`id`,\n"; $sql .= " documents.`main_category`,\n"; $sql .= " documents.`sub_category`,\n"; $sql .= " documents.`originator`,\n"; $sql .= " documents.`copyright`,\n"; $sql .= " documents.`issuer`,\n"; $sql .= " documents.`issued_date`,\n"; $sql .= " documents.`reciever`,\n"; $sql .= " documents.`recieved_date`,\n"; $sql .= " documents.`no`,\n"; $sql .= " documents.`title`,\n"; $sql .= " documents.`revision_prefix`,\n"; $sql .= " documents.`revision_no`,\n"; $sql .= " documents.`revision_suffix`,\n"; $sql .= " documents.`revision_date`,\n"; $sql .= " documents.`volume`,\n"; $sql .= " documents.`volumes`,\n"; $sql .= " documents.`print_size`,\n"; $sql .= " documents.`file_extension`,\n"; $sql .= " documents.`source_file_extension`,\n"; $sql .= " documents.`prepared_by`,\n"; $sql .= " documents.`checked_by`,\n"; $sql .= " documents.`approved_by`,\n"; $sql .= " documents.`remarks`,\n"; $sql .= " documents.`file_name`,\n"; $sql .= " documents.`added_by`,\n"; $sql .= " documents.`added_on`,\n"; $sql .= " documents.`show`\n"; $sql .= " From\n"; $sql .= " documents documents\n"; if ($updateCond != "") { $sql .= " where " . $updateCond; } $result = mysql_query($sql) or die("Invalid query"); $row = mysql_fetch_array($result); $uploadDir = "documents"."/"; $optUpdate = 1; $maxFileSize = 31457280; $fieldFileName = "" . $row[9] . "-" . $row[11] . "" . $row[12] . "" . $row[13] . ""; if($_FILES['upload_fd24']['name'] <> "") { if($_FILES['upload_fd24']['size'] <= $maxFileSize) { $ext = substr( $_FILES['upload_fd24']['name'], strrpos( $_FILES['upload_fd24']['name'], "." )+1 ); $ext1 = substr( $fieldFileName, strrpos( $fieldFileName, "." )+1 ); if ($ext1 == "") { $newFileName = $fieldFileName.".".strtolower($ext); } elseif ($ext1 == $ext) { $newFileName = $fieldFileName; } else { $newFileName = $fieldFileName.".".strtolower($ext); // change the extention to lower case } $uploadFile = $uploadDir.$newFileName; if (move_uploaded_file($_FILES['upload_fd24']['tmp_name'], $uploadFile)) // Success Upload { $meta = mysql_fetch_field($result,24); $field_name = $meta->name; if ($value_sql == "") { if ($optUpdate == 0) { // Update with full path $value_sql .= $quotechar.$field_name.$quotechar." = '".$uploadFile."'" ; } elseif ($optUpdate == 1) { // Update with file name only $value_sql .= $quotechar.$field_name.$quotechar." = '".$newFileName."'" ; } else { #$value_sql .= $quotechar.$field_name.$quotechar." = '".$row[24]."'" ; } } else { if ($optUpdate == 0) { // Update with full path $value_sql .= ", ".$quotechar.$field_name.$quotechar." = '".$uploadFile."'" ; } elseif ($optUpdate == 1) { // Update with file name only $value_sql .= ", ".$quotechar.$field_name.$quotechar." = '".$newFileName."'" ; } else { #$value_sql .= ", ".$quotechar.$field_name.$quotechar." = '".$row[24]."'" ; } } } else // Fail in upload { $err_string = "Cannot upload file! There is problem occured when upload." ; } } else { $err_string = "<font color= red>Your file size is bigger than the maximum size(".$maxFileSize." byte) that we allow to upload</font>"; } } } if($_FILES['upload_fd28']['name'] != "") { $sql = ""; $sql .= " Select\n"; $sql .= " documents.`id`,\n"; $sql .= " documents.`main_category`,\n"; $sql .= " documents.`sub_category`,\n"; $sql .= " documents.`originator`,\n"; $sql .= " documents.`copyright`,\n"; $sql .= " documents.`issuer`,\n"; $sql .= " documents.`issued_date`,\n"; $sql .= " documents.`reciever`,\n"; $sql .= " documents.`recieved_date`,\n"; $sql .= " documents.`no`,\n"; $sql .= " documents.`title`,\n"; $sql .= " documents.`revision_prefix`,\n"; $sql .= " documents.`revision_no`,\n"; $sql .= " documents.`revision_suffix`,\n"; $sql .= " documents.`revision_date`,\n"; $sql .= " documents.`volume`,\n"; $sql .= " documents.`volumes`,\n"; $sql .= " documents.`print_size`,\n"; $sql .= " documents.`file_extension`,\n"; $sql .= " documents.`source_file_extension`,\n"; $sql .= " documents.`prepared_by`,\n"; $sql .= " documents.`checked_by`,\n"; $sql .= " documents.`approved_by`,\n"; $sql .= " documents.`remarks`,\n"; $sql .= " documents.`file_name`,\n"; $sql .= " documents.`added_by`,\n"; $sql .= " documents.`added_on`,\n"; $sql .= " documents.`show`\n"; $sql .= " From\n"; $sql .= " documents documents\n"; if ($updateCond != "") { $sql .= " where " . $updateCond; } $result = mysql_query($sql) or die("Invalid query"); $row = mysql_fetch_array($result); $uploadDir = "documents"."/"; $optUpdate = 2; $maxFileSize = 31457280; $fieldFileName = "" . $row[9] . "-" . $row[11] . "" . $row[12] . "" . $row[13] . ""; if($_FILES['upload_fd28']['name'] <> "") { if($_FILES['upload_fd28']['size'] <= $maxFileSize) { $ext = substr( $_FILES['upload_fd28']['name'], strrpos( $_FILES['upload_fd28']['name'], "." )+1 ); $ext1 = substr( $fieldFileName, strrpos( $fieldFileName, "." )+1 ); if ($ext1 == "") { $newFileName = $fieldFileName.".".strtolower($ext); } elseif ($ext1 == $ext) { $newFileName = $fieldFileName; } else { $newFileName = $fieldFileName.".".strtolower($ext); // change the extention to lower case } $uploadFile = $uploadDir.$newFileName; if (move_uploaded_file($_FILES['upload_fd28']['tmp_name'], $uploadFile)) // Success Upload { } else // Fail in upload { $err_string = "Cannot upload file! There is problem occured when upload." ; } } else { $err_string = "<font color= red>Your file size is bigger than the maximum size(".$maxFileSize." byte) that we allow to upload</font>"; } } } if($_FILES['upload_fd29']['name'] != "") { $sql = ""; $sql .= " Select\n"; $sql .= " documents.`id`,\n"; $sql .= " documents.`main_category`,\n"; $sql .= " documents.`sub_category`,\n"; $sql .= " documents.`originator`,\n"; $sql .= " documents.`copyright`,\n"; $sql .= " documents.`issuer`,\n"; $sql .= " documents.`issued_date`,\n"; $sql .= " documents.`reciever`,\n"; $sql .= " documents.`recieved_date`,\n"; $sql .= " documents.`no`,\n"; $sql .= " documents.`title`,\n"; $sql .= " documents.`revision_prefix`,\n"; $sql .= " documents.`revision_no`,\n"; $sql .= " documents.`revision_suffix`,\n"; $sql .= " documents.`revision_date`,\n"; $sql .= " documents.`volume`,\n"; $sql .= " documents.`volumes`,\n"; $sql .= " documents.`print_size`,\n"; $sql .= " documents.`file_extension`,\n"; $sql .= " documents.`source_file_extension`,\n"; $sql .= " documents.`prepared_by`,\n"; $sql .= " documents.`checked_by`,\n"; $sql .= " documents.`approved_by`,\n"; $sql .= " documents.`remarks`,\n"; $sql .= " documents.`file_name`,\n"; $sql .= " documents.`added_by`,\n"; $sql .= " documents.`added_on`,\n"; $sql .= " documents.`show`\n"; $sql .= " From\n"; $sql .= " documents documents\n"; if ($updateCond != "") { $sql .= " where " . $updateCond; } $result = mysql_query($sql) or die("Invalid query"); $row = mysql_fetch_array($result); $uploadDir = "documents"."/"; $optUpdate = 2; $maxFileSize = 31457280; $fieldFileName = "" . $row[9] . "-" . $row[11] . "" . $row[12] . "" . $row[13] . ""; if($_FILES['upload_fd29']['name'] <> "") { if($_FILES['upload_fd29']['size'] <= $maxFileSize) { $ext = substr( $_FILES['upload_fd29']['name'], strrpos( $_FILES['upload_fd29']['name'], "." )+1 ); $ext1 = substr( $fieldFileName, strrpos( $fieldFileName, "." )+1 ); if ($ext1 == "") { $newFileName = $fieldFileName.".".strtolower($ext); } elseif ($ext1 == $ext) { $newFileName = $fieldFileName; } else { $newFileName = $fieldFileName.".".strtolower($ext); // change the extention to lower case } $uploadFile = $uploadDir.$newFileName; if (move_uploaded_file($_FILES['upload_fd29']['tmp_name'], $uploadFile)) // Success Upload { } else // Fail in upload { $err_string = "Cannot upload file! There is problem occured when upload." ; } } else { $err_string = "<font color= red>Your file size is bigger than the maximum size(".$maxFileSize." byte) that we allow to upload</font>"; } } } if (($err_string=="")&&($value_sql!="")) { $sql = ""; $sql = "update " . $quotechar . mysql_field_table($result,0) . $quotechar; $sql .= " set " . $value_sql; $sql .= " where "; $sql .= $updateCond; if ($result > 0) {mysql_free_result($result);} if (!$result = @mysql_query($sql)){ $err_string .= "<strong>Error:</strong>while updating<br>" . mysql_error(); } } if ($err_string == "") { if ($qry_string != "") { $URL= $submiturl . "&" . $qry_string; } else { $URL= $submiturl; } header ("Location: $URL"); exit; } } //end if ProcessForm } //end if act ?> <HTML> <HEAD> <Title>Add Documents</Title> <link rel="stylesheet" type="text/css" href="kordil_edms_2.css"> <script type="text/javascript" src="./js/yahoo-min.js" ></script> <script type="text/javascript" src="./js/dom-min.js" ></script> <script type="text/javascript" src="./js/event-min.js" ></script> <script type="text/javascript"> YAHOO.util.Event.onDOMReady( function() { qsPageonloadController(); } ); </script> <link rel="stylesheet" type="text/css" href="./css/ContentLayout.css"></link> <script type="text/javascript"> // Declares all constants and arrays // for all page items used on the page // Declare Field Indexes for all page items var qsPageItemsCount = 29 var __Title = 0; var _No = 1; var __Revision_date = 2; var _Revision_prefix = 3; var __Revision_no = 4; var _Revision_suffix = 5; var _Main_category = 6; var _Sub_category = 7; var _Originator = 8; var _Copyright = 9; var _Issuer = 10; var _Reciever = 11; var _Issued_date = 12; var _Recieved_date = 13; var _Volume = 14; var _Volumes = 15; var _Print_size = 16; var _File_extension = 17; var _Source_file_extension = 18; var _Prepared_by = 19; var _Checked_by = 20; var _Approved_by = 21; var _Remarks = 22; var __File__main_ = 23; var _File__extention_1_ = 24; var _File__extention_2_ = 25; var _Added_by = 26; var _Added_on = 27; var _Show = 28; // Declare Fields Prompts var fieldPrompts = []; fieldPrompts[__Title] = "*Title"; fieldPrompts[_No] = "*Number"; fieldPrompts[__Revision_date] = "*Revision date"; fieldPrompts[_Revision_prefix] = "Revision prefix"; fieldPrompts[__Revision_no] = "*Revision no"; fieldPrompts[_Revision_suffix] = "Revision suffix"; fieldPrompts[_Main_category] = "Main category"; fieldPrompts[_Sub_category] = "Sub category"; fieldPrompts[_Originator] = "Originator"; fieldPrompts[_Copyright] = "Copyright"; fieldPrompts[_Issuer] = "Issuer"; fieldPrompts[_Reciever] = "Reciever"; fieldPrompts[_Issued_date] = "Issued date"; fieldPrompts[_Recieved_date] = "Recieved date"; fieldPrompts[_Volume] = "Volume"; fieldPrompts[_Volumes] = "Volumes"; fieldPrompts[_Print_size] = "Print size"; fieldPrompts[_File_extension] = "File extension"; fieldPrompts[_Source_file_extension] = "Source file extension"; fieldPrompts[_Prepared_by] = "Prepared by"; fieldPrompts[_Checked_by] = "Checked by"; fieldPrompts[_Approved_by] = "Approved by"; fieldPrompts[_Remarks] = "Remarks"; fieldPrompts[__File__main_] = "*File (main)"; fieldPrompts[_File__extention_1_] = "File (extention 1)"; fieldPrompts[_File__extention_2_] = "File (extention 2)"; fieldPrompts[_Added_by] = "Added by"; fieldPrompts[_Added_on] = "Added on"; fieldPrompts[_Show] = "Show"; // Declare Fields Technical Names var fieldTechNames = []; fieldTechNames[__Title] = "_Title"; fieldTechNames[_No] = "No"; fieldTechNames[__Revision_date] = "_Revision_date"; fieldTechNames[_Revision_prefix] = "Revision_prefix"; fieldTechNames[__Revision_no] = "_Revision_no"; fieldTechNames[_Revision_suffix] = "Revision_suffix"; fieldTechNames[_Main_category] = "Main_category"; fieldTechNames[_Sub_category] = "Sub_category"; fieldTechNames[_Originator] = "Originator"; fieldTechNames[_Copyright] = "Copyright"; fieldTechNames[_Issuer] = "Issuer"; fieldTechNames[_Reciever] = "Reciever"; fieldTechNames[_Issued_date] = "Issued_date"; fieldTechNames[_Recieved_date] = "Recieved_date"; fieldTechNames[_Volume] = "Volume"; fieldTechNames[_Volumes] = "Volumes"; fieldTechNames[_Print_size] = "Print_size"; fieldTechNames[_File_extension] = "File_extension"; fieldTechNames[_Source_file_extension] = "Source_file_extension"; fieldTechNames[_Prepared_by] = "Prepared_by"; fieldTechNames[_Checked_by] = "Checked_by"; fieldTechNames[_Approved_by] = "Approved_by"; fieldTechNames[_Remarks] = "Remarks"; fieldTechNames[__File__main_] = "_File__main_"; fieldTechNames[_File__extention_1_] = "File__extention_1_"; fieldTechNames[_File__extention_2_] = "File__extention_2_"; fieldTechNames[_Added_by] = "Added_by"; fieldTechNames[_Added_on] = "Added_on"; fieldTechNames[_Show] = "Show"; // This function dynamically assigns element 'ID' attributes to all relevant elements function qsAssignElementIDs() { // STEP 1: Assign an ID to all field PROMPTS (TD captions) // Scan all table TD tags for those that match field prompts var TDs = document.getElementsByTagName("td"); for (var i=0; i < TDs.length; i++) { var element = TDs[i]; // Check if the TD found is one of the Page Items header // This can only be an approximation as some TDs other than the actual field prompts // may contain the same caption. In that case all TDs found will carry the same ID. if (element.className == "ThRows" || element.className == "TrOdd") { for (var f=0; f < qsPageItemsCount; f++) { if (element.innerHTML == fieldPrompts[f]) { element.id = fieldTechNames[f] + "_caption_cell"; element.innerHTML = "<div id='" + fieldTechNames[f] + "_caption_div'>" + element.innerHTML + "</div>"; } } } } // STEP 2: Assign an ID to all Input controls on the form document.getElementsByName("add_fd10")[0].id = fieldTechNames[__Title]; document.getElementsByName("add_fd9")[0].id = fieldTechNames[_No]; document.getElementsByName("add_fd14")[0].id = fieldTechNames[__Revision_date]; document.getElementsByName("add_fd11")[0].id = fieldTechNames[_Revision_prefix]; document.getElementsByName("add_fd12")[0].id = fieldTechNames[__Revision_no]; document.getElementsByName("add_fd13")[0].id = fieldTechNames[_Revision_suffix]; document.getElementsByName("add_fd1")[0].id = fieldTechNames[_Main_category]; document.getElementsByName("add_fd2")[0].id = fieldTechNames[_Sub_category]; document.getElementsByName("add_fd3")[0].id = fieldTechNames[_Originator]; document.getElementsByName("add_fd4")[0].id = fieldTechNames[_Copyright]; document.getElementsByName("add_fd5")[0].id = fieldTechNames[_Issuer]; document.getElementsByName("add_fd7")[0].id = fieldTechNames[_Reciever]; document.getElementsByName("add_fd6")[0].id = fieldTechNames[_Issued_date]; document.getElementsByName("add_fd8")[0].id = fieldTechNames[_Recieved_date]; document.getElementsByName("add_fd15")[0].id = fieldTechNames[_Volume]; document.getElementsByName("add_fd16")[0].id = fieldTechNames[_Volumes]; document.getElementsByName("add_fd17")[0].id = fieldTechNames[_Print_size]; document.getElementsByName("add_fd18")[0].id = fieldTechNames[_File_extension]; document.getElementsByName("add_fd19")[0].id = fieldTechNames[_Source_file_extension]; document.getElementsByName("add_fd20")[0].id = fieldTechNames[_Prepared_by]; document.getElementsByName("add_fd21")[0].id = fieldTechNames[_Checked_by]; document.getElementsByName("add_fd22")[0].id = fieldTechNames[_Approved_by]; document.getElementsByName("add_fd23")[0].id = fieldTechNames[_Remarks]; document.getElementsByName("upload_fd24")[0].id = fieldTechNames[__File__main_]; document.getElementsByName("upload_fd28")[0].id = fieldTechNames[_File__extention_1_]; document.getElementsByName("upload_fd29")[0].id = fieldTechNames[_File__extention_2_]; document.getElementsByName("add_fd25")[0].id = fieldTechNames[_Added_by]; document.getElementsByName("add_fd26")[0].id = fieldTechNames[_Added_on]; document.getElementsByName("add_fd27")[0].id = fieldTechNames[_Show]; } // This function defines object names for all page items used on the page. // You can refer to these objects in your Javascript code and avoid getElementById(). // Entry Fields (when present) are accessible via their technical names. // The prompts of Entry Fields (when present) are accessible using SomeItemName_Prompt object names. // function qsPageItemsAbstraction() { qs_form = document.getElementsByName("qs_add_form")[0]; //Define Form Object by Name. pgitm__Title = document.getElementsByName("add_fd10")[0]; pgitm_No = document.getElementsByName("add_fd9")[0]; pgitm__Revision_date = document.getElementsByName("add_fd14")[0]; pgitm_Revision_prefix = document.getElementsByName("add_fd11")[0]; pgitm__Revision_no = document.getElementsByName("add_fd12")[0]; pgitm_Revision_suffix = document.getElementsByName("add_fd13")[0]; pgitm_Main_category = document.getElementsByName("add_fd1")[0]; pgitm_Sub_category = document.getElementsByName("add_fd2")[0]; pgitm_Originator = document.getElementsByName("add_fd3")[0]; pgitm_Copyright = document.getElementsByName("add_fd4")[0]; pgitm_Issuer = document.getElementsByName("add_fd5")[0]; pgitm_Reciever = document.getElementsByName("add_fd7")[0]; pgitm_Issued_date = document.getElementsByName("add_fd6")[0]; pgitm_Recieved_date = document.getElementsByName("add_fd8")[0]; pgitm_Volume = document.getElementsByName("add_fd15")[0]; pgitm_Volumes = document.getElementsByName("add_fd16")[0]; pgitm_Print_size = document.getElementsByName("add_fd17")[0]; pgitm_File_extension = document.getElementsByName("add_fd18")[0]; pgitm_Source_file_extension = document.getElementsByName("add_fd19")[0]; pgitm_Prepared_by = document.getElementsByName("add_fd20")[0]; pgitm_Checked_by = document.getElementsByName("add_fd21")[0]; pgitm_Approved_by = document.getElementsByName("add_fd22")[0]; pgitm_Remarks = document.getElementsByName("add_fd23")[0]; pgitm__File__main_ = document.getElementsByName("upload_fd24")[0]; pgitm_File__extention_1_ = document.getElementsByName("upload_fd28")[0]; pgitm_File__extention_2_ = document.getElementsByName("upload_fd29")[0]; } </script> <script type="text/javascript"> // This function dynamically assigns custom events // to page item controls on this page function qsAssignPageItemEvents() { } </script> <script language="javascript"> function Trim(s){ var temp = " "; var i = 0; while ((temp == " ") && (i <= s.length)) { temp = s.charAt(i); i++; } s = s.substring(i - 1, s.length); return(s); } function check(frm) { var szAlert = "Invalid\n"; var nIndex = 0; if (!RequiredField(frm.add_fd10.value)) { nIndex++; szAlert += "- " +"'Title' cannot be blank\n"; } if (!RequiredField(frm.add_fd9.value)) { nIndex++; szAlert += "- " +"'No' cannot be blank\n"; } if (!RequiredField(frm.add_fd12.value)) { nIndex++; szAlert += "- " +"'Revision no' cannot be blank\n"; } if (!NumberValidate(frm.add_fd15.value)) { nIndex++; szAlert += "- " +"'Volume' invalid numeric format\n"; } if (!NumberValidate(frm.add_fd16.value)) { nIndex++; szAlert += "- " +"'Volumes' invalid numeric format\n"; } if(nIndex > 0) { alert(szAlert) ; return false ; } return true ; } </script> <script src="validate.js"></script> <script> // This function controls the onunload event dispatching function qsPageonunloadController() { } // This function controls the onresize event dispatching function qsPageonresizeController() { var lastResult = false return true; } // This function controls the onload events dispatching function qsPageonloadController() { var lastResult = false // Invoke the technical field names abstraction initialization qsPageItemsAbstraction(); // Invoke the Element IDs assignment function qsAssignElementIDs(); // Invoke the Page Items custom events assignments qsAssignPageItemEvents(); // Assign Event Handlers for page-level events YAHOO.util.Event.addListener(window, "beforeunload", qsPageonunloadController); YAHOO.util.Event.addListener(window, "resize", qsPageonresizeController); // Set focus on first enterable page item available pgitm__Title.focus(); return true; } // This function controls the onsubmit event dispatching function qsFormonsubmitController(frm) { var lastResult = false // Call the standard Kordil_EDMSform validation rules lastResult = check(frm); if (lastResult == false) { return false; } return true; } // This function controls the onreset event dispatching function qsPageonresetController() { var lastResult = false return true; } </script> <script language='javascript' src='qwikcalendar.js'></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </HEAD> <BODY> <?php include('logo.htm'); ?><?php include('menu.php'); ?><?php include('menu.htm'); ?><Center> <center><hr /><font size="1"> Add Documents </font><hr /></center><br> <A NAME=top></A> <table id="QS_Content_Layout_1_Table"> <tr id="QS_Content_Layout_1_TopRow"> <td id="QS_Content_Layout_1_NorthWest"> <div id="QS_Content_Layout_1_NorthWestDiv"> </div> </td> <td id="QS_Content_Layout_1_North"> <div id="QS_Content_Layout_1_NorthDiv"> </div> </td> <td id="QS_Content_Layout_1_NorthEast"> <div id="QS_Content_Layout_1_NorthEastDiv"> </div> </td> </tr> <tr id="QS_Content_Layout_1_MiddleRow"> <td id="QS_Content_Layout_1_West"> <div id="QS_Content_Layout_1_WestDiv"> </div> </td> <td id="QS_Content_Layout_1_Center"> <div id="QS_Content_Layout_1_CenterDiv"> <script> function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if ( aQueryString[iParam].indexOf(strParamName + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return strReturn; } </script> <Form name="qs_add_form" method="post" action="./documents_add.php" enctype="multipart/form-data" onsubmit="return qsFormonsubmitController(this)" onreset="return qsPageonresetController(this)" > <?php print $hidden_tag; ?> <Table Border="0" Cellpadding="2" Cellspacing="1" BgColor="#D4D4D4"> <?php $css_class = "\"TrOdd\""; ?> <tr> <td colspan="2" class="ThRows">Add Documents</td> </tr> <?php if ($err_string != "") { print "<tr>"; print "<td class=\"ThRows\"><Strong>Error:</Strong></td>"; print "<td class=" . $css_class . " align=Default>" . $err_string . "</td>"; print "</tr>"; } ?> <tr> <td class="ThRows">*Title</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd10"])) && (!isset($_POST["add_fd10"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd10"); } $cellvalue = "<input type=\"text\" name=\"add_fd10\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" size=\"100\" maxlength=\"255\" >"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> <?php $cellvalue = ""; if ((!isset($_GET["add_fd9"])) && (!isset($_POST["add_fd9"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd9"); } // Below is the snippet where I am getting the Tender ID dynamically using Get Method $cellvalue = "<input type=\"hidden\" name=\"add_fd9\" value=\"" . qsreplace_html_quote(stripslashes($_GET["id"])) . "\" size=\"70\" maxlength=\"255\" >"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">*Revision date</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd14"])) && (!isset($_POST["add_fd14"]))) { $itemvalue = ""; if ($itemvalue == "") { $itemvalue = qsconvertdate(date("Y-m-d h:i:s"),"yyyy-mm-dd"); } } else { $itemvalue = qsrequest("add_fd14"); } $cellvalue = "<input type=\"text\" name=\"add_fd14\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\"><a href=\"#add_fd14\"><a name=\"add_fd14\"><img src=\"images/Calendar.gif\" width=\"20\" height=\"21\" border=0 align=\"absmiddle\" onclick=\"popUpCalendar(this, qs_form.add_fd14, 'yyyy-mm-dd', 0, 0)\"></a><input type=\"hidden\" name=\"add_fd14_DateFormat\" value=\"yyyy-mm-dd\" />"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Revision prefix</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd11"])) && (!isset($_POST["add_fd11"]))) { $itemvalue = "" . $row[11] . ""; } else { $itemvalue = qsrequest("add_fd11"); } $cellvalue = "<select name=\"add_fd11\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-------------</option>" . qsmysqlgen_listbox(" Select Distinct `prefix`,`prefix` From `revision_prefix` Order by `prefix` Asc ","add_fd11","prefix","prefix",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">*Revision no</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd12"])) && (!isset($_POST["add_fd12"]))) { $itemvalue = "" . $row[12] . ""; } else { $itemvalue = qsrequest("add_fd12"); } $cellvalue = "<select name=\"add_fd12\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-------------</option>" . qsmysqlgen_listbox(" Select Distinct `revision_enumarator`,`revision_enumarator` From `revision_number` Order by `revision_enumarator` Asc ","add_fd12","revision_enumarator","revision_enumarator",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Revision suffix</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd13"])) && (!isset($_POST["add_fd13"]))) { $itemvalue = "" . $row[13] . ""; } else { $itemvalue = qsrequest("add_fd13"); } $cellvalue = "<select name=\"add_fd13\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-------------</option>" . qsmysqlgen_listbox(" Select Distinct `suffix`,`suffix` From `revision_suffix` Order by `suffix` Asc ","add_fd13","suffix","suffix",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Main category</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd1"])) && (!isset($_POST["add_fd1"]))) { $itemvalue = "" . $row[1] . ""; } else { $itemvalue = qsrequest("add_fd1"); } $cellvalue = "<select name=\"add_fd1\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-----------------------------------</option>" . qsmysqlgen_listbox(" Select Distinct `main_category`,`main_category` From `main_category` Order by `main_category` Asc ","add_fd1","main_category","main_category",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Sub category</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd2"])) && (!isset($_POST["add_fd2"]))) { $itemvalue = "" . $row[2] . ""; } else { $itemvalue = qsrequest("add_fd2"); } $cellvalue = "<select name=\"add_fd2\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-----------------------------------</option>" . qsmysqlgen_listbox(" Select Distinct `sub_category`,`sub_category` From `sub_category` Order by `sub_category` Asc ","add_fd2","sub_category","sub_category",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Originator</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd3"])) && (!isset($_POST["add_fd3"]))) { $itemvalue = "" . $row[3] . ""; } else { $itemvalue = qsrequest("add_fd3"); } $cellvalue = "<select name=\"add_fd3\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-------------------------</option>" . qsmysqlgen_listbox(" Select Distinct `originator`,`originator` From `originator` Order by `originator` Asc ","add_fd3","originator","originator",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Copyright</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd4"])) && (!isset($_POST["add_fd4"]))) { $itemvalue = "" . $row[4] . ""; } else { $itemvalue = qsrequest("add_fd4"); } $cellvalue = "<select name=\"add_fd4\" ><option value=\"-------------------------\"" . qscheckselected("-------------------------",$itemvalue,"selected") . ">-------------------------</option>" . qsmysqlgen_listbox(" Select Distinct `copyright`,`copyright` From `copyright` Order by `copyright` Asc ","add_fd4","copyright","copyright",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Issuer</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd5"])) && (!isset($_POST["add_fd5"]))) { $itemvalue = "" . $row[5] . ""; } else { $itemvalue = qsrequest("add_fd5"); } $cellvalue = "<select name=\"add_fd5\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-------------------------</option>" . qsmysqlgen_listbox(" Select Distinct `issuer`,`issuer` From `issuer` Order by `issuer` Asc ","add_fd5","issuer","issuer",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Reciever</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd7"])) && (!isset($_POST["add_fd7"]))) { $itemvalue = "" . $row[7] . ""; } else { $itemvalue = qsrequest("add_fd7"); } $cellvalue = "<select name=\"add_fd7\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-------------------------</option>" . qsmysqlgen_listbox(" Select Distinct `reciever`,`reciever` From `reciever` Order by `reciever` Asc ","add_fd7","reciever","reciever",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Issued date</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd6"])) && (!isset($_POST["add_fd6"]))) { $itemvalue = ""; if ($itemvalue == "") { $itemvalue = qsconvertdate(date("Y-m-d h:i:s"),"yyyy-mm-dd"); } } else { $itemvalue = qsrequest("add_fd6"); } $cellvalue = "<input type=\"text\" name=\"add_fd6\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\"><a href=\"#add_fd6\"><a name=\"add_fd6\"><img src=\"images/Calendar.gif\" width=\"20\" height=\"21\" border=0 align=\"absmiddle\" onclick=\"popUpCalendar(this, qs_form.add_fd6, 'yyyy-mm-dd', 0, 0)\"></a><input type=\"hidden\" name=\"add_fd6_DateFormat\" value=\"yyyy-mm-dd\" />"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Recieved date</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd8"])) && (!isset($_POST["add_fd8"]))) { $itemvalue = ""; if ($itemvalue == "") { $itemvalue = qsconvertdate(date("Y-m-d h:i:s"),"yyyy-mm-dd"); } } else { $itemvalue = qsrequest("add_fd8"); } $cellvalue = "<input type=\"text\" name=\"add_fd8\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\"><a href=\"#add_fd8\"><a name=\"add_fd8\"><img src=\"images/Calendar.gif\" width=\"20\" height=\"21\" border=0 align=\"absmiddle\" onclick=\"popUpCalendar(this, qs_form.add_fd8, 'yyyy-mm-dd', 0, 0)\"></a><input type=\"hidden\" name=\"add_fd8_DateFormat\" value=\"yyyy-mm-dd\" />"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Volume</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd15"])) && (!isset($_POST["add_fd15"]))) { $itemvalue = "1"; } else { $itemvalue = qsrequest("add_fd15"); } $cellvalue = "<input type=\"text\" name=\"add_fd15\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\">"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Volumes</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd16"])) && (!isset($_POST["add_fd16"]))) { $itemvalue = "1"; } else { $itemvalue = qsrequest("add_fd16"); } $cellvalue = "<input type=\"text\" name=\"add_fd16\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\">"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Print size</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd17"])) && (!isset($_POST["add_fd17"]))) { $itemvalue = "" . $row[17] . ""; } else { $itemvalue = qsrequest("add_fd17"); } $cellvalue = "<select name=\"add_fd17\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">-------------------------</option>" . qsmysqlgen_listbox(" Select Distinct `print_size`,`print_size` From `print_size` Order by `print_size` Asc ","add_fd17","print_size","print_size",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">File extension</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd18"])) && (!isset($_POST["add_fd18"]))) { $itemvalue = "" . $row[18] . ""; } else { $itemvalue = qsrequest("add_fd18"); } $cellvalue = "<select name=\"add_fd18\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">---------</option>" . qsmysqlgen_listbox(" Select Distinct `extension`,`extension` From `file_extention` Order by `extension` Asc ","add_fd18","extension","extension",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Source file extension</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd19"])) && (!isset($_POST["add_fd19"]))) { $itemvalue = "" . $row[19] . ""; } else { $itemvalue = qsrequest("add_fd19"); } $cellvalue = "<select name=\"add_fd19\" ><option value=\"\"" . qscheckselected("",$itemvalue,"selected") . ">---------</option>" . qsmysqlgen_listbox(" Select Distinct `extension`,`extension` From `file_extention` Order by `extension` Asc ","add_fd19","extension","extension",$itemvalue) . "</select>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Prepared by</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd20"])) && (!isset($_POST["add_fd20"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd20"); } $cellvalue = "<input type=\"text\" name=\"add_fd20\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" size=\"30\" maxlength=\"255\" >"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Checked by</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd21"])) && (!isset($_POST["add_fd21"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd21"); } $cellvalue = "<input type=\"text\" name=\"add_fd21\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" size=\"30\" maxlength=\"255\" >"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Approved by</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd22"])) && (!isset($_POST["add_fd22"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd22"); } $cellvalue = "<input type=\"text\" name=\"add_fd22\" value=\"" . qsreplace_html_quote(stripslashes($itemvalue)) . "\" size=\"30\" maxlength=\"255\" >"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">Remarks</td> <?php $cellvalue = ""; if ((!isset($_GET["add_fd23"])) && (!isset($_POST["add_fd23"]))) { $itemvalue = ""; } else { $itemvalue = qsrequest("add_fd23"); } $cellvalue = "<textarea name=\"add_fd23\" cols=\"70\" rows=\"5\" >" . qsreplace_html_quote(stripslashes($itemvalue)) . "</textarea>"; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">*File (main)</td> <?php $cellvalue = "<input type=\"file\" name=\"upload_fd24\">"; ; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">File (extention 1)</td> <?php $cellvalue = "<input type=\"file\" name=\"upload_fd28\">"; ; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <tr> <td class="ThRows">File (extention 2)</td> <?php $cellvalue = "<input type=\"file\" name=\"upload_fd29\">"; ; if ($cellvalue == "") { $cellvalue = " "; } print "<td class=" . $css_class . " align=Default >" . $cellvalue . "</td>"; ?> </tr> <?php $cellvalue = "<input type=\"hidden\" name=\"add_fd25\" value=\"". @$_SESSION["UserLogon"] ."\">"; if ($cellvalue == "") { $cellvalue = " "; } print $cellvalue; ?> <?php $cellvalue = "<input type=\"hidden\" name=\"add_fd26\" value=\" ".date("Y-m-d h:i:s")." \">"; if ($cellvalue == "") { $cellvalue = " "; } print $cellvalue; ?> <?php $cellvalue = "<input type=\"hidden\" name=\"add_fd27\" value=\"1\">"; if ($cellvalue == "") { $cellvalue = " "; } print $cellvalue; ?> <?php #----get back url page---- $backurl = "http://localhost:8080/MPCS-war/faces/Tender/tenderStages.xhtml?"; ?> <tr> <td class="ThRows"> </td> <td class="TrOdd" align=Default> <input type="hidden" name="act" value="n"> <input type="button" name="QS_Back" value="Back" onclick="javascript:window.location='<?php print $backurl; ?>'"> <input type="submit" name="QS_Submit" value="Add" onclick="javascript:window.location='<?php print $backurl; ?>'"> <input type="reset" name="QS_Reset" value="Reset"> </td> </tr> </Table><br> </Form> <?php if ($result > 0) {mysql_free_result($result);} if ($link > 0) {mysql_close($link);} ?> </div> </td> <td id="QS_Content_Layout_1_East"> <div id="QS_Content_Layout_1_EastDiv"> </div> </td> </tr> <tr id="QS_Content_Layout_1_BottomRow"> <td id="QS_Content_Layout_1_SouthWest"> <div id="QS_Content_Layout_1_SouthWestDiv"> </div> </td> <td id="QS_Content_Layout_1_South"> <div id="QS_Content_Layout_1_SouthDiv"> </div> </td> <td id="QS_Content_Layout_1_SouthEast"> <div id="QS_Content_Layout_1_SouthEastDiv"> </div> </td> </tr> </table> <A NAME=bottom></A> <center> <center><a href="http://www.kordil.com/"><font face="Arial" size="1">© Kordil 2009</font></a></center> <center><font face="Arial" size="2"> </font></center> <center><font face="Arial" size="2">Kordil EDMS v2.2.60rc3</font></center> <center><font face="Arial" size="1">Electronic Document Management System</font></center> <center><font face="Arial" size="1">Kordil EDMS Official Website: <a href="http://www.kordil.net/">www.kordil.net</a></font></center> <center> </center> <center> </center> <center> </center> </center> <center> </center> </CENTER> <?php include('footer.htm'); ?> <?php echo $getID_On_Redirect; ?> </BODY> </HTML> Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413572 Share on other sites More sharing options...
cyberRobot Posted February 20, 2013 Share Posted February 20, 2013 I ran a quick search for $submiturl on your code and it looks like the ID was never added to the URL. <?php $submiturl = "./documents_add.php?id="; ?> Did you try adding the GET variable? <?php $submiturl = "./documents_add.php?id=" . $_GET['id']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1413643 Share on other sites More sharing options...
raghavbhat Posted February 22, 2013 Author Share Posted February 22, 2013 Ok done, thanks. <?php $submiturl = "./documents_add.php?id=" . $_SESSION['id']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/274661-problem-getting-values-from-url/#findComment-1414084 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.