divadiva Posted November 25, 2008 Share Posted November 25, 2008 I have two pagesPage A and Page B.Page A when I click on it asks me to enter database password as it calls superpw() function from other PHP page.When I enter Session password it opens up the form. Here is the code for Page A: if($edit) { //Check for dblog and dbsup if( $dblog == $dbsup) { // logged in to superadmin database if($delete) { delete(); } else { if($done) { save(); } //**** Displaying form form(); } } else { superpw() ;// FUNCTION CALLED FROM OTHER PHP PAGE } } else { error() ; } } function form() { global $globvars; extract($globvars) ; //$globvars['super_pass'] = sp_code($super_pass,'e') ; //Trying to pass session value $globvars['super_pass'] = $_SESSION['password']; ihide('super_pass'); $string = "SELECT * FROM `inventory` LEFT JOIN `super_inv` ON `inventory`.`inventory_id` = `super_inv`.`inventory_id` WHERE `inventory`.`inventory_id` = '$edit' LIMIT 1"; // print $string ; $item = mysql_query("$string"); $i_row = mysql_fetch_array($item); if(mysql_num_rows($item)) { foreach($db_inv as $db_field) { $$db_field = $i_row[$db_field]; } foreach($db_sup as $db_field) { $$db_field = $i_row[$db_field]; } $inventory_id = $i_row['inventory_id']; $logistics_loc = $i_row['logistics_loc'] ; %> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> <TBODY> <TR> <TD> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"> <TBODY> <TR> <TD><B>Extra Data</B></TD> <TD ALIGN="CENTER"><%= $msg ; %></TD> <TD ALIGN="CENTER"><A HREF="<%= 'editinvent.php?edit=' . $edit . '&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords) . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Main Data Page</A></TD> <TD ALIGN="CENTER"><A HREF="editinvent.php">New Search</A></TD> <TD ALIGN="CENTER"><A HREF="<%= 'editinvent.php?dlist=1&skip=' . $skip . '&sdisp=' . $sdisp . '&smanuf=' . rawurlencode($smanuf) . '&sprocess=' . rawurlencode($sprocess) . '&swafer=' . rawurlencode($swafer) . '&swords=' . rawurlencode($swords) . '&sstatus=' . rawurlencode($sstatus) . '&slocation=' . $slocation . '&sfund=' . $sfund . '&sorder=' . rawurlencode($sorder) ; %>">Return to list</A></TD> </TR> </TBODY> </TABLE></TD> </TR> <TR> <TD><IMG SRC="../images/blank.gif" WIDTH="1" HEIGHT="20" BORDER="0" ALT=" "></TD> </TR> <% if(allow_types($gen_authreq['superadmin'])) { %> <TR> <TD> <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable" WIDTH="100%"> <TBODY> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>COST BASIS</B></TD> <TD> <INPUT TYPE="TEXT" NAME="cost_basis" SIZE="9" MAXLENGTH="9" VALUE="<%= $cost_basis ; %>"></TD> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Refurb Costs - Labour</B></TD> <TD> <INPUT TYPE="TEXT" NAME="refurb_lab" SIZE="9" MAXLENGTH="9" VALUE="<%= $refurb_lab ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Commission</B></TD> <TD> <INPUT TYPE="TEXT" NAME="commission" SIZE="9" MAXLENGTH="9" VALUE="<%= $commission ; %>"></TD> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Refurb Costs - Parts</B></TD> <TD> <INPUT TYPE="TEXT" NAME="refurb_parts" SIZE="9" MAXLENGTH="9" VALUE="<%= $refurb_parts ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Crating</B></TD> <TD> <INPUT TYPE="TEXT" NAME="crating" SIZE="9" MAXLENGTH="9" VALUE="<%= $crating ; %>"></TD> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Refurb Costs - T&E</B></TD> <TD> <INPUT TYPE="TEXT" NAME="refurb_te" SIZE="9" MAXLENGTH="9" VALUE="<%= $refurb_te ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Shipping</B></TD> <TD> <INPUT TYPE="TEXT" NAME="shipping" SIZE="9" MAXLENGTH="9" VALUE="<%= $shipping ; %>"></TD> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Refurb Costs - Other</B></TD> <TD> <INPUT TYPE="TEXT" NAME="refurb_other" SIZE="9" MAXLENGTH="9" VALUE="<%= $refurb_other ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>De-install</B></TD> <TD> <INPUT TYPE="TEXT" NAME="deinstall" SIZE="9" MAXLENGTH="9" VALUE="<%= $deinstall ; %>"></TD> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Storage</B></TD> <TD> <INPUT TYPE="TEXT" NAME="storage" SIZE="9" MAXLENGTH="9" VALUE="<%= $storage ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Insurance</B></TD> <TD> <INPUT TYPE="TEXT" NAME="insurance" SIZE="9" MAXLENGTH="9" VALUE="<%= $insurance ; %>"></TD> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Unrecovered Tax</B></TD> <TD> <INPUT TYPE="TEXT" NAME="unrec_tax" SIZE="9" MAXLENGTH="9" VALUE="<%= $unrec_tax ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Loss Damage</B></TD> <TD> <INPUT TYPE="TEXT" NAME="loss_damage" SIZE="9" MAXLENGTH="9" VALUE="<%= $loss_damage ; %>"></TD> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"> </TD> <TD></TD> </TR> </TBODY> </TABLE></TD> </TR> <TR> <TD ALIGN="CENTER" HEIGHT="40" VALIGN="MIDDLE"> <INPUT TYPE="SUBMIT" NAME="Submit1" VALUE="SAVE PAGE"></TD> </TR> <TR> <TD ALIGN="CENTER" VALIGN="MIDDLE"> <% $topts = array('actual','low','mid','high') ; $string = "SELECT * FROM `fair_marketvalue` WHERE `inventory_id` = '$edit' ORDER BY `date`"; $query = mysql_query("$string"); %> <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable" WIDTH="100%"> <TBODY> <TR> <TD STYLE="background-color:#B6DAF2;"><B>Date<br> dd/mm/yyyy</B></TD> <TD STYLE="background-color:#B6DAF2;"><B>Name</B></TD> <TD STYLE="background-color:#B6DAF2;"><B>Low Value</B></TD> <TD STYLE="background-color:#B6DAF2;"><B>Medium Value</B></TD> <TD STYLE="background-color:#B6DAF2;"><B>High Value</B></TD> <TD STYLE="background-color:#B6DAF2;"><B>Original Value</B></TD> <TD STYLE="background-color:#B6DAF2;"><B>Del</B></TD> </TR> <% if(mysql_num_rows($query)) { %> <TR> <TD COLSPAN="7" ALIGN="LEFT" STYLE="background-color:#EBEBEB;"><B>Existing Valuations</B></TD> </TR> <% while($f_row = mysql_fetch_array($query)) { $fbit = $f_row['fmv_id']; %> <TR> <TD> <INPUT TYPE="TEXT" NAME="<%= 'fmv_date_' . $fbit ; %>" SIZE="10" MAXLENGTH="10" VALUE="<%= ddate($f_row['date'],'d/m/Y','') ; %>"> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="<%= 'fmv_name_' . $fbit ; %>" SIZE="50" MAXLENGTH="200" VALUE="<%= $f_row['name'] ; %>"> </TD> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="<%= 'fmv_low_value_' . $fbit ; %>" SIZE="9" MAXLENGTH="9" VALUE="<%= $f_row['low_value'] ; %>"></TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="<%= 'fmv_mid_value_' . $fbit ; %>" SIZE="9" MAXLENGTH="9" VALUE="<%= $f_row['mid_value'] ; %>"></TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="<%= 'fmv_high_value_' . $fbit ; %>" SIZE="9" MAXLENGTH="9" VALUE="<%= $f_row['high_value'] ; %>"></TD> <TD ALIGN="CENTER"> <INPUT TYPE="checkbox" NAME="<%= 'fmv_orignal_' . $fbit ; %>" <% if($f_row['orignal'] ) echo 'checked="true"'; %>/> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="CHECKBOX" NAME="<%= 'fmv_del_' . $fbit ; %>" VALUE="1"></TD> </TR> <% } } %> <TR> <TD COLSPAN="7" ALIGN="LEFT" STYLE="background-color:#EBEBEB;"><B>Add New Valuation</B></TD> </TR> <TR> <TD> <INPUT TYPE="TEXT" NAME="fmv_date_new" SIZE="10" MAXLENGTH="10"> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="fmv_name_new" SIZE="50" MAXLENGTH="200"> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="fmv_low_value_new" SIZE="9" MAXLENGTH="9"> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="fmv_mid_value_new" SIZE="9" MAXLENGTH="9"> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="TEXT" NAME="fmv_high_value_new" SIZE="9" MAXLENGTH="9"> </TD> <TD ALIGN="CENTER"> <INPUT TYPE="checkbox" NAME="fmv_orignal_new"> </TD> <TD ALIGN="CENTER"> </TD> </TR> </TBODY> </TABLE></TD> </TR> <TR> <TD ALIGN="CENTER" HEIGHT="40" VALIGN="MIDDLE"> <INPUT TYPE="SUBMIT" NAME="Submit1" VALUE="SAVE PAGE"></TD> </TR> <TR> <TD> <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable" WIDTH="100%"> <TBODY> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>SALES STATUS</B></TD> <TD> <SELECT NAME="status_inv" CLASS="box"> <% $result = mysql_query( "SELECT * FROM `inv_status` ORDER BY `status`" ); while($a_row = mysql_fetch_array($result)){ if($a_row['status']==$status_inv) { print '<OPTION VALUE="' . $a_row['status'] . '" SELECTED="SELECTED">' . $a_row['status_desc'] . '</OPTION>' . "\n"; } else { print '<OPTION VALUE="' . $a_row['status'] . '">' . $a_row['status_desc'] . '</OPTION>' . "\n"; } } %> </SELECT></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>SHIPPING STATUS</B></TD> <TD> <SELECT NAME="ship_status" CLASS="box"> <% $result = mysql_query( "SELECT * FROM `ship_status` ORDER BY `ship_ref`" ); while($a_row = mysql_fetch_array($result)){ if($a_row['ship_ref']==$ship_status) { print '<OPTION VALUE="' . $a_row['ship_ref'] . '" SELECTED="SELECTED">' . $a_row['ship_desc'] . '</OPTION>' . "\n"; } else { print '<OPTION VALUE="' . $a_row['ship_ref'] . '">' . $a_row['ship_desc'] . '</OPTION>' . "\n"; } } %> </SELECT> to <INPUT TYPE="TEXT" NAME="ship_transit" MAXLENGTH="30" STYLE="width:153px;" VALUE="<%= $ship_transit ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145" HEIGHT="22"><B>LOGISTICS LOC'N</B></TD> <TD HEIGHT="22"> <% if($logistics_loc && isset($logi_loc[$logistics_loc])) { print $logi_loc[$logistics_loc] ; } %></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Purchased From</B></TD> <TD> <SELECT NAME="purchase_from" CLASS="box" STYLE="width:175px;"> <OPTION VALUE="">** Enter/None **</OPTION> <% $result = mysql_query( "SELECT DISTINCT `purchase_from` FROM `inventory` ORDER BY `purchase_from`" ); while($a_row = mysql_fetch_array($result)){ if($a_row['purchase_from']) { if($a_row['purchase_from']==$purchase_from) { print '<OPTION VALUE="' . $a_row['purchase_from'] . '" SELECTED="SELECTED">' . $a_row['purchase_from'] . '</OPTION>' . "\n"; } else { print '<OPTION VALUE="' . $a_row['purchase_from'] . '">' . $a_row['purchase_from'] . '</OPTION>' . "\n"; } } } %> </SELECT> or <INPUT TYPE="TEXT" NAME="purchase_from_new" SIZE="25" MAXLENGTH="80" STYLE="width:153px;"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Purchase Date</B></TD> <TD> <INPUT TYPE="TEXT" NAME="purchase_date" SIZE="10" MAXLENGTH="10" VALUE="<%= ddate($purchase_date,'d/m/Y','') ; %>"> dd/mm/yyyy</TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>New Price</B></TD> <TD> <INPUT TYPE="TEXT" NAME="new_price" SIZE="9" MAXLENGTH="9" VALUE="<%= $new_price ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Original Asking Price</B></TD> <TD> <INPUT TYPE="TEXT" NAME="original_ask" SIZE="9" MAXLENGTH="9" VALUE="<%= $original_ask ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Insurance Value</B></TD> <TD> <INPUT TYPE="TEXT" NAME="insurance_val" SIZE="9" MAXLENGTH="9" VALUE="<%= $insurance_val ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Stepped Up Cost Basis QB</B></TD> <TD> <INPUT TYPE="TEXT" NAME="step_qb" SIZE="9" MAXLENGTH="9" VALUE="<%= $step_qb ; %>"></TD> </TR> </TBODY> </TABLE></TD> </TR> <TR> <TD ALIGN="CENTER" HEIGHT="40" VALIGN="MIDDLE"> <INPUT TYPE="SUBMIT" NAME="Submit1" VALUE="SAVE PAGE"></TD> </TR> <TR> <TD> <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" CLASS="dtable" WIDTH="100%"> <TBODY> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Contracted Price</B></TD> <TD> <INPUT TYPE="TEXT" NAME="contract_price" SIZE="9" MAXLENGTH="9" VALUE="<%= $contract_price ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Amount Paid</B></TD> <TD> <INPUT TYPE="TEXT" NAME="order_paid" SIZE="12" MAXLENGTH="12" VALUE="<%= $order_paid ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Order Date</B></TD> <TD> <INPUT TYPE="TEXT" NAME="order_date" SIZE="10" MAXLENGTH="10" VALUE="<%= ddate($order_date,'d/m/Y','') ; %>"> dd/mm/yyyy</TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Invoice No</B></TD> <TD> <INPUT TYPE="TEXT" NAME="invoice_num" SIZE="25" MAXLENGTH="40" VALUE="<%= $invoice_num ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Customer</B></TD> <TD> <SELECT NAME="buyer" CLASS="box" STYLE="width:175px;"> <OPTION VALUE="">** Enter/None **</OPTION> <% $result = mysql_query( "SELECT DISTINCT `buyer` FROM `inventory` ORDER BY `buyer`" ); while($a_row = mysql_fetch_array($result)){ if($a_row['buyer']) { if($a_row['buyer']==$buyer) { print '<OPTION VALUE="' . $a_row['buyer'] . '" SELECTED="SELECTED">' . $a_row['buyer'] . '</OPTION>' . "\n"; } else { print '<OPTION VALUE="' . $a_row['buyer'] . '">' . $a_row['buyer'] . '</OPTION>' . "\n"; } } } %> </SELECT> or <INPUT TYPE="TEXT" NAME="buyer_new" SIZE="25" MAXLENGTH="80" STYLE="width:153px;"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Date Shipped To Buyer</B></TD> <TD> <INPUT TYPE="TEXT" NAME="date_ship" SIZE="10" MAXLENGTH="10" VALUE="<%= ddate($date_ship,'d/m/Y','') ; %>"> dd/mm/yyyy</TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Final Destination</B></TD> <TD> <INPUT TYPE="TEXT" NAME="final_dest" SIZE="25" MAXLENGTH="40" VALUE="<%= $final_dest ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>APV Export Approval Date</B></TD> <TD> <INPUT TYPE="TEXT" NAME="apv_date" SIZE="10" MAXLENGTH="10" VALUE="<%= ddate($apv_date,'d/m/Y','') ; %>"> dd/mm/yyyy</TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Independent Export Approval Date</B></TD> <TD> <INPUT TYPE="TEXT" NAME="indep_approv" SIZE="10" MAXLENGTH="10" VALUE="<%= ddate($indep_approv,'d/m/Y','') ; %>"> dd/mm/yyyy</TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Name of Independent</B></TD> <TD> <INPUT TYPE="TEXT" NAME="approv_name" SIZE="25" MAXLENGTH="80" VALUE="<%= $approv_name ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>CCATS</B></TD> <TD> <INPUT TYPE="TEXT" NAME="ccats" SIZE="25" MAXLENGTH="80" VALUE="<%= $ccats ; %>"></TD> </TR> <TR> <TD STYLE="background-color:#B6DAF2;" WIDTH="145"><B>Export Control Status</B></TD> <TD> <INPUT TYPE="TEXT" NAME="exp_control" SIZE="25" MAXLENGTH="80" VALUE="<%= $exp_control ; %>"></TD> </TR> </TBODY> </TABLE> </TD> </TR> <TR> <TD ALIGN="CENTER" HEIGHT="40" VALIGN="MIDDLE"> <INPUT TYPE="SUBMIT" NAME="Submit1" VALUE="SAVE PAGE"> <INPUT TYPE="HIDDEN" NAME="done" VALUE="1"> </TD> </TR> <% } if($edit){ %> <TR> <TD ALIGN="RIGHT"><%/*%>Delete Item (be sure!) <INPUT TYPE="CHECKBOX" NAME="delete" VALUE="1"><%*/%></TD> </TR> <% } %> </TBODY> </TABLE> <% } else { error() ; } } function save() { global $globvars; global $err_arr ; $err_arr = array(); foreach($globvars['db_inv'] as $db_field) { globvars($db_field); } foreach($globvars['db_sup'] as $db_field) { globvars($db_field); } extract($globvars) ; foreach($dat_arr as $date_field) { $$date_field = dcdate($$date_field,"Y-m-d") ; } if($ship_status != 2) { $ship_transit = ''; } if($purchase_from_new) { $purchase_from = $purchase_from_new ; } if($buyer_new) { $buyer = $buyer_new ; } // update inventory fields $string1 = ""; foreach($globvars['db_inv'] as $db_field) { if($string1) { $string1 .= ', ' ; } $string1 .= "`$db_field` = '" . $$db_field . "'" ; } $string = "UPDATE `inventory` SET $string1 WHERE `inventory_id` = '$edit' LIMIT 1"; // print_p($string) ; $query = mysql_query("$string"); // add/update super_inv fields $string2 = ""; foreach($globvars['db_sup'] as $db_field) { if($string2) { $string2 .= ', ' ; } $string2 .= "`$db_field` = '" . $$db_field . "'" ; } $string = "SELECT * FROM `super_inv` WHERE `inventory_id` = '$edit'" ; $query = mysql_query("$string") ; if(mysql_num_rows($query)) { // update $string = "UPDATE `super_inv` SET $string2 WHERE `inventory_id` = '$edit' LIMIT 1"; } else { // add $string = "INSERT INTO `super_inv` SET `inventory_id` = '$edit', $string2"; } // print_p($string) ; $query = mysql_query("$string"); // update or delete fmv items $string = "SELECT * FROM `fair_marketvalue` WHERE `inventory_id` = '$edit' ORDER BY `date`"; $query1 = mysql_query("$string"); while( $f_row = mysql_fetch_array($query1) ) { $fmv_id = $f_row['fmv_id']; $thisd = rawurlencode( 'fmv_del_' . $fmv_id) ; globvars($thisd); if($globvars[$thisd]) { // delete $string = "DELETE FROM `fair_marketvalue` WHERE `fmv_id` = '$fmv_id' LIMIT 1"; } else { // update $string3 = ""; foreach($globvars['db_fmv'] as $db_field) { $thisf = rawurlencode( 'fmv_' . $db_field . '_' . $fmv_id) ; globvars($thisf); $thisfv = $globvars[$thisf]; if($db_field == 'date') { $thisfv = dcdate($thisfv,'Y-m-d'); } else if($db_field == 'orignal'){ if($globvars[$thisf]) $thisfv = 1; else $thisfv = 0; } if($string3) { $string3 .= ', ' ; } $string3 .= "`$db_field` = '" . $thisfv . "'" ; } $string = "UPDATE `fair_marketvalue` SET $string3 WHERE fmv_id='$fmv_id' LIMIT 1"; } //print_p($string) ; $query = mysql_query("$string"); } // add new fmv item $save4 = 0 ; $string4 = "`inventory_id` = '$edit'" ; foreach($globvars['db_fmv'] as $db_field) { $thisn = 'fmv_' . $db_field . '_new' ; globvars($thisn); $thisnv = $globvars[$thisn]; if($db_field == 'date') { $thisnv = dcdate($thisnv,'Y-m-d'); if($thisnv) { $save4 = 1 ; } } else if($db_field == 'orignal'){ if($thisnv) $thisnv = 1; else $thisnv = 0; } $string4 .= ", `$db_field` = '" . $thisnv . "'" ; } if($save4) { $string = "INSERT INTO `fair_marketvalue` SET $string4"; // print_p($string) ; $query = mysql_query("$string"); } } function delete() { /* global $globvars; extract($globvars) ; $string = "SELECT * FROM `inventory` WHERE `inventory_id` = '$edit' LIMIT 1 "; $query = mysql_query("$string"); $a_row = mysql_fetch_array($query); $manufacturer = $a_row['manufacturer']; $process = $a_row['process']; $string = "DELETE FROM `inventory` WHERE `inventory_id` = '$edit' LIMIT 1"; // print_p($string); mysql_query("$string"); $string = "DELETE FROM `super_inv` WHERE `inventory_id` = '$edit' LIMIT 1"; // print_p($string); mysql_query("$string"); $string = "DELETE FROM `super_fmv` WHERE `inventory_id` = '$edit' LIMIT 1"; // print_p($string); mysql_query("$string"); // delete manufacturer if no longer required $string = "SELECT * FROM `inventory` WHERE `manufacturer` = '$manufacturer' LIMIT 1"; $query = mysql_query("$string"); if(!mysql_num_rows($query)) { $string = "DELETE FROM `manufacturers` WHERE `man_name` = '$manufacturer' LIMIT 1"; // print_p($string); mysql_query("$string"); } // delete process if no longer required $string = "SELECT * FROM `inventory` WHERE `process` = '$process' LIMIT 1"; $query = mysql_query("$string"); if(!mysql_num_rows($query)) { $string = "DELETE FROM `process` WHERE `pro_name` = '$process' LIMIT 1"; // print_p($string); mysql_query("$string"); } %> <P><B>Inventory id <%= $edit ; %> deleted</B></P> <P><A HREF="editinvent.php">Click here</A> to return to Edit Inventory Page</P> <% */ } function error() { %> <P><B>Item not found</B></P> <P><A HREF="XYZ.php">Click here</A> to return to XYZPage</P> <% } %> </FORM> </BODY> </HTML> Page B has the form for database password screen.Here is the code: <FORM> <%*/ function superpw() { %> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"> <TBODY> <TR> <TD>Database Password</TD> <TD> </TD> <TD> <INPUT TYPE="PASSWORD" NAME="super_pass" SIZE="20"></TD> //superpass further refer to function in other page <TD> </TD> <TD> <INPUT TYPE="SUBMIT" NAME="Submit1" VALUE='Go'></TD> </TR> </TBODY> </TABLE> <%} /*%> </FORM> <%*/ return; %> </BODY> </HTML> My goal is to get rid of database password screen instead of that I should only see the report.Or is it possible to set the value of the textbox so that it automatically runs? Any suggestion? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/134230-how-to-activate-a-button-in-php/ Share on other sites More sharing options...
waynew Posted November 25, 2008 Share Posted November 25, 2008 So, you don't want the page to be authorized-users only? Link to comment https://forums.phpfreaks.com/topic/134230-how-to-activate-a-button-in-php/#findComment-698741 Share on other sites More sharing options...
divadiva Posted November 25, 2008 Author Share Posted November 25, 2008 Thankyou for replying. The page is already been used by auithorized users.I have configured this page so now system uses SESSION password.Now I want to get rid of that database password that means that whenever user (administrator) wants to view this report he should not enter a password. He should only see report page.Thing is when I do this if( $dblog == $dbsup) { // logged in to superadmin database if($delete) { delete(); } else { if($done) { save(); } //**** Displaying form form(); } } else { form() } } else { error() ; } } I get the message that ITEM not found which is an error message. Any help? Link to comment https://forums.phpfreaks.com/topic/134230-how-to-activate-a-button-in-php/#findComment-698745 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.