Jump to content

how to retain buttons after clicking


esandra

Recommended Posts

//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  :shy:

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.