Jump to content

lesliesoon

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lesliesoon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yep i am sending the chemicals i ticked away to another page that will display the chemical's name, Location, Controlled, and Quantity, and at that page there is a back button to return to the selection page which i hope the check box will still be ticked. I also have a working search bar in which it will search for which ever chemicals i want by the name, with the checkbox at the side(also uncheck my checkbox when i click search). Lastly If i changed my checkbox name to something else could i still display out what i have ticked? i need to assign all the chemicals in the row with the value $count so i can display them without typing out all the 20+ checkboxes for each chemicals
  2. it still doesnt work :/ its the same as before when i refresh or submit the page the checkbox unchecks byitself when i go back to the page no errors though.
  3. Hello, i am quite new to php and i need some help in making my checkbox stay checked. I have been searching tutorials about checkboxes for hours but i still cant find one which fits my needs because none of them has a variable as a checkbox name. I will admit my friend helped me alot in the checkbox part but i still dont fully get it... would be great if someone was kind enough to explain them to me Description ======= Ok i am making a chemical printout.i have added a chemical list from the database and the idea is to print out the list of chemicals which i checked in the checkbox. The table currently is able to print out which ever checkbox i have ticked but the problem is if i click on refresh or submit button, the checkbox automatically unchecked it. this is my current checkbox $count=0(initially). ignore the sql connection and the search bar coding with it "SelectedChemicalsPrintingPage.php" is the other folder that i will be directed to after i clicked on submit. There, it will print out all the chemicals which i had checked. <?php error_reporting (0); mysql_select_db("leslie", mysql_connect("localhost","root","")); $result=mysql_query('select * from table2 WHERE Chemicals LIKE "%'.$_REQUEST['Search'].'%" '.$Controlled); $count=0; echo "<form action=SelectedChemicalsPrintingPage.php method=post>"; echo " <table border='1'> <tr> <th>Select</th> <th>Chemicals</th> <th>Quantity</th> <th>Location</th> <th>Controlled</th> </tr> "; while($row = mysql_fetch_array($result)) { echo " <tr> <td><input type=checkbox name=".$count." value=".$row[Chemicals]."></td> <td>" . $row[Chemicals] . "</td> <td>" . $row[Quantity] . "</td> <td>" . $row[Location] . "</td> <td>" . $row[Controlled] . "</td> </tr> "; if( isset($_POST[$count]) ) echo "checked='checked'"; <---i suppose this is placed wrongly? $count++; } echo '</table>'; echo ' <input type=hidden name=counts value="'.$count.'"> <input type=submit name=submit > </form> '; ?>
×
×
  • 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.