esandra Posted September 2, 2010 Share Posted September 2, 2010 //my program generates this button ($tcl) more than one times and then when i click it all the ($tcl) buttons would //disappear. what ive been trying to do here is when i click one of the $tcl buttons, they would remain visible until i choose //another date. how do i do this? <table height="100%" width="70%"> <tr><form name="date" method="post"> //this part gets the date <td align="left">SELECT : <select name="date" id="date"> <?php $query="select distinct date from arrastre order by date desc"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $date=$row['date']; echo "<option value='".$date."'>$date</option>"; } ?> </select> //this the part that the $tcl buttons are created using $date from above as reference <input name="godate" type="submit" value="go"></form> <br><br><br> </tr> <tr> <td align="left">TCL: <?php if(isset($_POST['godate'])){ $date=$_POST['date']; $query="select distinct tcl from arrastre where date='$date' order by tcl asc"; $result=mysql_query($query); echo '<form method="POST"><input type="hidden" name="date" value="'. $date. '">'; while($row=mysql_fetch_array($result)){ $tcl=$row['tcl']; ?> <input type="submit" name="tcl" value="<?php echo $tcl; ?>"> //this is the button generated more than one time depending on how many $tcl there on that date <?php } } ?> </form> </tr> //this part takes the $tcl and $date to display the values from the database <?php if((isset($_POST['tcl'])) && (isset($_POST['date']))){ $tcl=$_POST['tcl']; $date=$_POST['date']; $query = "select * from `arrastre` where `tcl` = '" . $tcl. "' and `date` = '" . $date . "' order by `tcl` asc"; $result = mysql_query($query) or die(mysql_error()); while($row=mysql_fetch_array($result)){ $orno=$row['orno']; $billnmbr=$row['billnmbr']; $payor=$row['payor']; $arrastre=$row['arrastre']; $wharfage=$row['wharfage']; $total=$row['total']; $date=$row['date']; } ?> <tr>///display part erased to shorten </tr> <?php }$_POST['tcl']=1; } ?> <tr> <td colspan="3"> <td colspan="2">total collections: <td align="right"><?php echo $totformat;?> </tr> </table> //my only problem here is that when i click a $tcl button and after it displays the form, all of the $tcl buttons would //disappear but i want them to still be there until i choose another date, only then should it display another set of $tcl //buttons //thank you for your time Quote Link to comment Share on other sites More sharing options...
RussellReal Posted September 2, 2010 Share Posted September 2, 2010 I'd love to help you.. but you made like no sense also use tags please Quote Link to comment Share on other sites More sharing options...
esandra Posted September 2, 2010 Author Share Posted September 2, 2010 yea i know this picture is hard to understand..but i really need help so ill try again 1. i get distinct $date from database then put the values into a combo box user can choose a date by selecting date from combo box then click go button 2. there may be more than 1 values of $tcl in one date so when i click a date which has more than one $tcl on it, there would be more than one $tcl buttons, one for every $tcl from that date my problem is that whenever i click a $tcl button all of the buttons would disappear. what i want to happen here is for the buttons to remain where they are so i could choose another $tcl from that date without going back to the date combo box again and again. so i want to choose date once and be able to click tcl lots of times from that date thanks Quote Link to comment Share on other sites More sharing options...
RussellReal Posted September 2, 2010 Share Posted September 2, 2010 try adding hidden fields to each form you create called 'godate' that will allow your first php block to execute Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 3, 2010 Share Posted September 3, 2010 If you want immidiate action without reloading the page you need javascript or ajax which is almost the same but it sounds cooler. Quote Link to comment Share on other sites More sharing options...
esandra Posted September 3, 2010 Author Share Posted September 3, 2010 try adding hidden fields to each form you create called 'godate' that will allow your first php block to execute wow one line did it..thanks Quote Link to comment Share on other sites More sharing options...
RussellReal Posted September 3, 2010 Share Posted September 3, 2010 no doubt mark as solved THANKS! Quote Link to comment 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.