Hi guys, i am currently working on a project that queries an inventory database through the use of radio buttons, for example; If the first button FOR THE Item(HAMMERS)is clicked, the output should be the name of the item, the number sold and the total profit(calculations) into a table. the way i have it now, when io click on the radio button my output comes back as the results for all the items in the table, i want it to display only the information about hammers, then only about each individual item when the corresponding radio button is clicked. any help would be greatly appreciated!!!
jetlife76 0 Junior Poster in Training
Recommended Answers
Jump to PostSo in other words you want us to provide you with a SQL string?
if(isset($_POST['name']) && in_array($_POST['name'],array('hammer','chisel','saw','spanner','all'))){ if($_POST['name'] == 'all')$where=""; }else{ $post = mysql_real_escape_string($_POST['name']); $where = " WHERE `Name` = '$post'"; } $SQLcmd = "select * from $table_name$where";
??
You could do that or for expansion's …
Jump to PostPerhaps if you actually posted your form code we could see what your form field names were...
Jump to PostI think you've misunderstood the use of radio - they should all have the same name attribute, i.e. name="name". You seem to be using these are glorified checkboxes. This is not their purpose. Optionboxes are there to chose either/or. Also you should choose a default value to be checked (checked="checked").
…
Jump to Postadd a variable to catch the value of your your chosen item $tools = $_POST, then display the selected item via id
<?php $tools = $_POST['tools']; $server = 'localhost'; $user = 'root'; $password = ''; $mydb = 'Tools'; $table_name = 'Inventory'; $SQLcmd = "select * from $table_name …
Jump to PostTotals should be acalculated field?
All 17 Replies
jetlife76 0 Junior Poster in Training

diafol
jetlife76 0 Junior Poster in Training

diafol
jetlife76 0 Junior Poster in Training

diafol
jetlife76 0 Junior Poster in Training
jetlife76 0 Junior Poster in Training
jawanda0 0 Newbie Poster
vaultdweller123 32 Posting Pro
jetlife76 0 Junior Poster in Training
vaultdweller123 32 Posting Pro
jetlife76 0 Junior Poster in Training
jetlife76 0 Junior Poster in Training

diafol
vaultdweller123 32 Posting Pro
jetlife76 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.