-
Posts
780 -
Joined
-
Last visited
Everything posted by mikebyrne
-
variables lost when moving to new php page
mikebyrne replied to mikebyrne's topic in PHP Coding Help
My page just seems to stay on the new.php page as opposed to going to processed.php the code for processed.php is now: <?php include('adminconnect.php'); $tbl1 = 'admn'; $process=$_POST['checkbox']; echo "Test" echo $process if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercompleted)VALUES(1)"; } else { echo "Not checked"; } ?> -
variables lost when moving to new php page
mikebyrne replied to mikebyrne's topic in PHP Coding Help
I've added <form action = "processed.php" method="post"> and <input type="submit" value="Process"> But code doesnt seem to work as it doesnt post a 1 to the orderscompleted field -
variables lost when moving to new php page
mikebyrne replied to mikebyrne's topic in PHP Coding Help
How would I word that? Also, does have my process button set to use a link affect things? -
I want an order processed when a checkbox is "checked" and the user clicks on the proceed button The code I have so far is: <form> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/new.php" class="black_on">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../sales/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../item/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_on"><a href="../admin_files/new.php" class="black_on">New orders</a></div> <div id="menu_space2"> <!-- --> </div> <div id="menu_text_off"><a href="../admin_files/Unprocessed.php" class="black">Unprocessed orders</a></div> <div id="menu_space2"> <!-- --> </div> <div id="menu_text_off"><a href="../admin_files/completed.php" class="black">Completed orders</a></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="64"> </td> <td width="33"> </td> <td width="86"><a href="#">order no.</a></td> <td width="63"><a href="#">date</a></td> <td width="240"><a href="#">customer name</a></td> <td width="172"><a href="#">e-mail</a></td> <td width="64" align="right"><a href="#">amount</a></td> <td width="23"> </td> <td width="138"><a href="#">shipping method</a></td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <!-- data start --> <div class="padTop11"> <!-- --> </div> <div class="clr"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <?php // let's get some data include('adminconnect.php'); $sql = mysql_query("SELECT OrderNo, Orderdate, Custname, Amount, Shippingmet FROM admin WHERE Orderdate = DATE_FORMAT(now(),'%y/%m/%d')"); while( $row = mysql_fetch_array($sql) ) { // loop through and display ?> <tr align="left"> <td width="33"> </td> <td><input type = "checkbox" name="checkbox" value="checked"></td> <td width="33"> </td> <td width="82"><a href="javascript:openWindow('popup_detail.html', 'NewWindow', 615, 600)" class="black"><?php echo $row['OrderNo'];?></a></td> <td width="61" align="center"><?php echo $row['Orderdate'];?></td> <td width="230" align="Left"><?php echo $row['Custname'];?></td> <td width="170" align="center"><?php echo $row['Trackno'];?></td> <td width="56" align="right"><?php echo $row['Amount'];?></td> <td width="21"> </td> <td width="136" align="center"><?php echo $row['Shippingmet'];?></td> </tr> <? } ?> </table> <!-- data finish --> <!-- --> </div> <div id="btn"> <div id="btnL"><img src="../Admin_files/btn_delete.gif" alt="delete" width="73" height="23" /></div> <div id="btnSpace"> <!-- --> </div> <div id="btnR"><a href="processed.php"><img src="../Admin_files/btn_process.gif" alt="process" width="73" height="23" border="0" /></a></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </form> And processed.php <?php include('adminconnect.php'); $tbl1 = 'admn'; $process=$_POST['checkbox']; if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercompleted)VALUES(1)"; } else { echo "Not checked"; } ?>
-
Can i just adjust the process button to a submit? Problem is I also want to place a delete button next so will the "method=post" still be ok? Here's my complete code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>ADMIN PAGE|order</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <form> <form name="start" method="post" action="processed.php"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/new.php" class="black_on">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../sales/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../item/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_on"><a href="../admin_files/new.php" class="black_on">New orders</a></div> <div id="menu_space2"> <!-- --> </div> <div id="menu_text_off"><a href="../admin_files/Unprocessed.php" class="black">Unprocessed orders</a></div> <div id="menu_space2"> <!-- --> </div> <div id="menu_text_off"><a href="../admin_files/completed.php" class="black">Completed orders</a></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="64"> </td> <td width="33"> </td> <td width="86"><a href="#">order no.</a></td> <td width="63"><a href="#">date</a></td> <td width="240"><a href="#">customer name</a></td> <td width="172"><a href="#">e-mail</a></td> <td width="64" align="right"><a href="#">amount</a></td> <td width="23"> </td> <td width="138"><a href="#">shipping method</a></td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <!-- data start --> <div class="padTop11"> <!-- --> </div> <div class="clr"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <?php // let's get some data include('adminconnect.php'); $sql = mysql_query("SELECT OrderNo, Orderdate, Custname, Amount, Shippingmet FROM admin WHERE Orderdate = DATE_FORMAT(now(),'%y/%m/%d')"); while( $row = mysql_fetch_array($sql) ) { // loop through and display ?> <tr align="left"> <td width="33"> </td> <td><input type = "checkbox" name="checkbox" value="checked"></td> <td width="33"> </td> <td width="82"><a href="javascript:openWindow('popup_detail.html', 'NewWindow', 615, 600)" class="black"><?php echo $row['OrderNo'];?></a></td> <td width="61" align="center"><?php echo $row['Orderdate'];?></td> <td width="230" align="Left"><?php echo $row['Custname'];?></td> <td width="170" align="center"><?php echo $row['Trackno'];?></td> <td width="56" align="right"><?php echo $row['Amount'];?></td> <td width="21"> </td> <td width="136" align="center"><?php echo $row['Shippingmet'];?></td> </tr> <? } ?> </table> <!-- data finish --> <!-- --> </div> <div id="btn"> <div id="btnL"><img src="../Admin_files/btn_delete.gif" alt="delete" width="73" height="23" /></div> <div id="btnSpace"> <!-- --> </div> <div id="btnR"><img src="../Admin_files/btn_process.gif" alt="process" width="73" height="23" border="0" /></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </form> </div> </div> </body> </html>
-
I added <form name="start" method="post" action="processed.php"> But still no joy
-
How do i set a FORM method=POST to the process button?
-
Seems nothing is being passed into it Would I need to create an Array on my new.php form??? What if I need to pass more than one "checked" record over??? Any ideas?
-
How can I see if $process=$_POST['checkbox']; contains any values??
-
The table sql is: CREATE TABLE `admin` ( `OrderNo` decimal(8,0) default NULL, `Orderdate` date default NULL, `Custname` char(10) collate latin1_general_ci default NULL, `Dispatchdate` date default NULL, `Trackno` decimal(8,0) default NULL, `Amount` decimal(5,0) default NULL, `Shippingmet` char(255) collate latin1_general_ci default NULL, `Ordercompleted` decimal(10,0) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-
At present I have a list of orders with checkboxs. When the user ticks the box and presses the proceed button I want a 1 to appear in my Orderscomplete field. At present my code is: New.php <table width="850" border="0" cellspacing="0" cellpadding="0"> <?php // let's get some data include('adminconnect.php'); $sql = mysql_query("SELECT OrderNo, Orderdate, Custname, Amount, Shippingmet FROM admin WHERE Orderdate = DATE_FORMAT(now(),'%y/%m/%d')"); while( $row = mysql_fetch_array($sql) ) { // loop through and display ?> <tr align="left"> <td width="33"> </td> <td><input type = "checkbox" name="checkbox" value="checked"></td> <td width="33"> </td> <td width="82"><a href="javascript:openWindow('popup_detail.html', 'NewWindow', 615, 600)" class="black"><?php echo $row['OrderNo'];?></a></td> <td width="61" align="center"><?php echo $row['Orderdate'];?></td> <td width="230" align="Left"><?php echo $row['Custname'];?></td> <td width="170" align="center"><?php echo $row['Trackno'];?></td> <td width="56" align="right"><?php echo $row['Amount'];?></td> <td width="21"> </td> <td width="136" align="center"><?php echo $row['Shippingmet'];?></td> </tr> <? } ?> </table></div> <div id="btnR"><a href="processed.php"><img src="../Admin_files/btn_process.gif" alt="process" width="73" height="23" border="0" /></a></div> <div class="clr"> Processed.php <?php include('adminconnect.php'); $tbl1 = 'admn'; $process=$_POST['checkbox']; if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercompleted)VALUES(1)"; } ?> The code just brings up a blank screen and doesnt add to the database
-
How could i check If $process is actually running (holding a varible)??
-
The code is now <?php include('adminconnect.php'); $tbl1 = 'admn'; $process=$_POST['checkbox']; if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercompleted)VALUES(1)"; } ?> It still doesnt post a 1 in the ordercompleted field in the admin database The structure of admin looks like this -- ---------------------------- -- Table structure for admin -- ---------------------------- CREATE TABLE `admin` ( `OrderNo` decimal(8,0) default NULL, `Orderdate` date default NULL, `Custname` char(10) collate latin1_general_ci default NULL, `Dispatchdate` date default NULL, `Trackno` decimal(8,0) default NULL, `Amount` decimal(5,0) default NULL, `Shippingmet` char(255) collate latin1_general_ci default NULL, `Ordercompleted` decimal(10,0) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- ---------------------------- -- Records -- ---------------------------- INSERT INTO `admin` VALUES ('34556', '2008-01-20', 'rob', '2008-01-21', '34112', '45', 'air', '1'); INSERT INTO `admin` VALUES ('41123', '2008-01-20', 'Mike', '2008-01-23', '99008', '45', 'Air', '1'); INSERT INTO `admin` VALUES ('676767', '2008-01-22', 'Gerry', '2008-02-01', '99999999', '13', 'hffhf', '0'); INSERT INTO `admin` VALUES ('5656', '2011-01-23', 'HHHH', '2008-02-07', '98989', '32', '333', '1'); INSERT INTO `admin` VALUES ('9695959', '2008-01-23', 'TEST', '2008-01-31', '56778', '500', 'Normal', '0'); INSERT INTO `admin` VALUES ('56566556', '2008-01-23', 'iurituritu', '2008-01-24', '989898', '33', 'test', '0'); INSERT INTO `admin` VALUES ('77777', '2008-01-24', 'jkjkjkj', '2008-02-09', '99999', '87', 'hjhj', '0');
-
I have changed the code to <?php include('adminconnect.php'); $process=$_POST['checkbox']; if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercompleted)VALUES(1)"; } ?> The error is gone but it doesn't do anything! ie alter the database
-
I presume an unexpected T_VARIABLE means it cant find the varible??
-
I changed that to: <?php include('adminconnect.php'); $tbl1 = 'admn' $process=$_POST['checkbox']; if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercompleted)VALUES(1)"; } ?> Getting the error Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\Admin_files\processed.php on line 6
-
All that seems to do is print out include('adminconnect.php'); $tbl1 = 'admn' Ive changed orderscomplted too include('adminconnect.php'); $tbl1 = 'admn' <?php $process=$_POST['checkbox']; if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercompleted)VALUES(1)"; } ?>
-
I have the following code $tbl1 = 'admn' <?php $process=$_POST['checkbox'] if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercomplete)VALUES(1)"; } ?> but im getting an error Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\Admin_files\processed.php on line 6
-
At the moment my form doesnt go anywhere it just loads the table. Would I create a page called processed.php and do this: $tbl1 = 'admn' <?php $process=$_POST['checkbox'] if($process =="checked") { $sql2="INSERT INTO $tbl1(Ordercomplete)VALUES(1)"; } ?>
-
I would like my admin section to process orders which are selected by the corresponding checkbox ie when the user presses the proceed button the loop starts then need a 1 to appear in my "Ordercompleted" field The code I have: <table width="850" border="0" cellspacing="0" cellpadding="0"> <?php // let's get some data include('adminconnect.php'); $sql = mysql_query("SELECT OrderNo, Orderdate, Custname, Amount, Shippingmet FROM admin WHERE Orderdate = DATE_FORMAT(now(),'%y/%m/%d')"); while( $row = mysql_fetch_array($sql) ) { // loop through and display ?> <tr align="left"> <td width="33"> </td> <td> <input type = "checkbox" name="checkbox"> </td> <td width="33"> </td> <td width="82"><a href="javascript:openWindow('popup_detail.html', 'NewWindow', 615, 600)" class="black"><?php echo $row['OrderNo'];?></a></td> <td width="61" align="center"><?php echo $row['Orderdate'];?></td> <td width="230" align="Left"><?php echo $row['Custname'];?></td> <td width="170" align="center"><?php echo $row['Trackno'];?></td> <td width="56" align="right"><?php echo $row['Amount'];?></td> <td width="21"> </td> <td width="136" align="center"><?php echo $row['Shippingmet'];?></td> </tr> <? } ?> </table> </div> <div id="btnR"><a href="unshipped.php"><img src="../Admin_files/btn_process.gif" alt="process" width="73" height="23" border="0" /></a></div> <div class="clr">
-
[SOLVED] Checkbox with displayed with every record in loop??
mikebyrne replied to mikebyrne's topic in PHP Coding Help
It was just a spacing issue with the html Thanks for all the help -
[SOLVED] Checkbox with displayed with every record in loop??
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Fixed it with <input type = "checkbox" name="checkbox"> But the checkbox displays above the valuse as opposed to on the same line -
[SOLVED] Checkbox with displayed with every record in loop??
mikebyrne replied to mikebyrne's topic in PHP Coding Help
Maybe ive requested the wrong thing? Isn't a checkbox a little box that displays a tick when you select it. The code above seems to provide me with an input box -
Hi I can get my records to display but Id like a checkbox to appear with every record. Can I incorporate this into my loop or will i have to display the results in a set table format and place the checkbox within this?? My code is: <?php // let's get some data include('adminconnect.php'); $sql = mysql_query("SELECT OrderNo, Orderdate, Custname, Amount, Shippingmet FROM admin WHERE Orderdate = DATE_FORMAT(now(),'%y/%m/%d')"); while( $row = mysql_fetch_array($sql) ) { // loop through and display ?> <tr align="left"> <td width="33"> </td> <td width="82"><a href="javascript:openWindow('popup_detail.html', 'NewWindow', 615, 600)" class="black"><?php echo $row['OrderNo'];?></a></td> <td width="61"><?php echo $row['Orderdate'];?></td> <td width="61"><?php echo $row['Dispatchdate'];?></td> <td width="230"><?php echo $row['Custname'];?></td> <td width="170"><?php echo $row['Trackno'];?></td> <td width="56" align="right"><?php echo $row['Amount'];?></td> <td width="21"> </td> <td width="136">test</td> </tr> <? } ?> </table>
-
THANKS!!!!