scadran Posted August 5, 2007 Share Posted August 5, 2007 Hi guys I am about to do two different actions on the same form with the same data. What I have done so far is that First: I have created two different submit button with the same name and different value <input type="submit" value="Publish Invoice" name="flag"> <input type="submit" value="Summary Report" name="flag"> in the action page I have got the data with POST and check the status of the submit value: <?php $flag = $_POST['flag']; if ($flag=='Publish Invoice') include('publish.php'); else { include('summary.php');} ?> when i press publish invoice buttomn i recieve the following error: Parse error: syntax error, unexpected '}' in C:\wamp\www\Pierra Invoice\publish.php on line 99 Just in case if you need the publish.php page, here it is: include('config.php'); $result = mysql_query("SELECT * FROM temp") or die(mysql_error()); $row = mysql_fetch_array($result); $cnt=1; $new_no = $row[6]; while ( $cnt <= $row[5] ) { $cd='a'.$cnt; $code = $_POST[$cd]; $tyre_arr = mysql_query("select * from tyre where code='$code'") or die(mysql_error()); $tyre = mysql_fetch_array($tyre_arr); ?> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-style: double; border-width: 3" bordercolor="#111111" width="1024" height="430"> <tr> <td width="100%" dir="rtl" height="430"> <img border="0" src="PIERRA%20LOGO.jpg" width="93" height="88" align="right"><div align="left"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="30%" > <tr> <td width="50%"><font face="B Compset" size="4"> شماره فاکتور:</font></td> <td width="50%"><font face="B Compset" size="4"> <?php if (strlen($new_no)==1) echo "0000".$new_no; elseif(strlen($new_no)==2) echo "000".$new_no; elseif(strlen($new_no)==3) echo "00".$new_no; elseif(strlen($new_no)==4) echo "0".$new_no; else echo $new_no; ?> </font></td> </tr> <tr> <td width="50%"><font face="B Compset" size="4"> تاریخ: </font></td> <td width="50%"><font face="B Compset" size="4"><?php echo $row[2]."/".$row[3]."/".$row[4]?></font></td> </tr> </table> </div> <p align="center"><font face="B Jadid" size="5">فاکتور سفارش</font></p> <p> <font face="B Compset" size="4"> نام خریدار: <?php echo $row[1]?></font></p> <div align="center"> <center> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="90%" id="AutoNumber3" height="52"> <tr bgcolor="#C0C0C0"> <td width="20%" align="center" height="19"><b><font face="Tahoma">کد پیرا</font></b></td> <td width="20%" align="center" height="19"><b><font face="Tahoma">سایز</font></b></td> <td width="20%" align="center" height="19"><b><font face="Tahoma"><span lang="en-us"> Serial Number</span></font></b></td> <td width="20%" align="center" height="19"><b><font face="Tahoma"><span lang="en-us"> Brand</span></font></b></td> <td width="20%" align="center" height="19"> <p dir="ltr"><b><font face="Tahoma"><span lang="en-us"> Price (Rial)</span></font></b></td> </tr> <tr> <td width="20%" align="center" height="32"> <font face="Tahoma" size="2"><span lang="en-us"><?php echo $tyre[0] ?></span></font></td> <td width="20%" align="center" height="32"><span lang="en-us"><p dir="ltr"> <font face="Tahoma" size="2"><?php echo $tyre[1] ?></font></span></p></td> <td width="20%" align="center" height="32"><span lang="en-us"> <font face="Tahoma" size="2"><?php echo $tyre[2] ?></font></span></td> <td width="20%" align="center" height="32"><span lang="en-us"> <font face="Tahoma" size="2"><?php echo $tyre[3] ?></font></span></td> <td width="20%" align="center" height="32"><span lang="en-us"> <font face="Tahoma" size="2"><?php echo number_format($tyre[4]) ?></font></span></td> </tr> <tr> <td width="80%" align="center" height="32" colspan="4"> <p align="right"><font face="Tahoma" size="2"><span lang="en-us"> </span>سه درصد عوارض فروش</font></td> <td width="20%" align="center" height="32"><?php echo number_format(0.03*$tyre[4]) ?></td> </tr> <tr> <td width="80%" align="center" height="32" colspan="4"> <p align="right"><font face="Tahoma" size="2"> </font> <font face="Tahoma">جمع کل:</font></td> <td width="20%" align="center" height="32" bgcolor="#CCCCCC"><?php echo number_format(0.03*$tyre[4]+$tyre[4]) ?></td> </tr> </table> </center> </div> <p> </p> <p > <br> اداره فروش </font> </p> <p align="left"> </p> </td> </tr> </table> </center> </div> <p align="center"> --------------------------------------------------------------------------------------------------------------</p> <?php $new_no = $row[6]+$cnt; $mosi = mysql_query("UPDATE temp SET last_invoice='$new_no' WHERE id='0'") or die(mysql_error()); $cnt = $cnt+1; } ?> tell me what is wrong now? ??? Link to comment https://forums.phpfreaks.com/topic/63431-multiple-action-on-the-same-form/ Share on other sites More sharing options...
scadran Posted August 5, 2007 Author Share Posted August 5, 2007 any idEA? Link to comment https://forums.phpfreaks.com/topic/63431-multiple-action-on-the-same-form/#findComment-316130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.