yami Posted May 11, 2022 Share Posted May 11, 2022 (edited) Hello ..I tried to bring some items from database and display them one by one on the screen..I put an input for each item I got from db ..my question is how can I get the value of each input of each item displayed on the screen?If anyone wants the code here it is: <?php $bringitem = $connection->query("SELECT * from item where idItem='$iditemm'"); if(!$bringitem){ echo mysqli_error($connection); } while($rowww = $bringitem->fetch_assoc()) { ?> <td> <?php echo $rowww['itemName'];?> </td> <td> <form action=""> <input type="number" id="quantity" name="quantity" min="1" max="50" style="width:3em;"> </form> </td> <?php } ?> Note : I am trying to get them all by one submit button Edited May 11, 2022 by yami Quote Link to comment https://forums.phpfreaks.com/topic/314780-how-to-get-the-value-of-each-input-of-each-data-i-bring-from-the-db/ Share on other sites More sharing options...
Barand Posted May 11, 2022 Share Posted May 11, 2022 23 minutes ago, yami said: Note : I am trying to get them all by one submit button You say all but only select a single item. And you don't have a submit button! Where is the $iditemm value coming from? 24 minutes ago, yami said: how can I get the value of each input No idea - where is it supposed to come from? Quote Link to comment https://forums.phpfreaks.com/topic/314780-how-to-get-the-value-of-each-input-of-each-data-i-bring-from-the-db/#findComment-1596157 Share on other sites More sharing options...
ginerjm Posted May 11, 2022 Share Posted May 11, 2022 (edited) Here's the code? What code? A bit of something from somewhere that has no resemblance to what you are asking "how to do" is all this is. You say you want to display the results of a query but you show one data field. You seem to be wanting to display it in an html table format but you don't know how to write one. And why exactly are you using input tags to 'display' your data? You don't say anything about doing an update. Now here is what your code looks like when written in a meaningful way so that you can see what you should really see: $bringitem = $connection->query("SELECT * from item where idItem='$iditemm'"); if(!$bringitem) { echo mysqli_error($connection); exit(); // Seem to have failed so why continue on? } while($rowww = $bringitem->fetch_assoc()) { // Let's show an item in a table but let's // not start a table nor start a row for that table // And let's even put that item in a form but don't plan on doing anything with it // And make sure I use some hokey html attributes to edit it instead of doing some // real editing in my php when I read it in, if I ever figure out how. // And why use a number field to display something called "itemname"?? echo " <td>{$rowww['itemName']}</td> <td> <form action=''> <input type='number' id='quantity' name='quantity' min='1' max='50' style='width:3em;'> </form> </td> "; // The end of my display of ONE item all by itself that no web browser is ever going to display } Sorry for being so harsh but you made absolutely no sense. Are you asking for help with a problem or showing us how you would do it? Really hard to tell from the way you posted this. Barand told you as much. I just went a lot further. Call me irritable. Edited May 11, 2022 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/314780-how-to-get-the-value-of-each-input-of-each-data-i-bring-from-the-db/#findComment-1596158 Share on other sites More sharing options...
samowns Posted May 12, 2022 Share Posted May 12, 2022 use mysqli //your must include your database file $q="SELECT * FROM table_name "; $ok=mysqli_query($con,$q); while($raq=mysqli_fetch_array($ok)){ <td><?php echo $raq[0];?></td>//Here u want to echo any row <?php }?>//Loop Close here Quote Link to comment https://forums.phpfreaks.com/topic/314780-how-to-get-the-value-of-each-input-of-each-data-i-bring-from-the-db/#findComment-1596171 Share on other sites More sharing options...
Barand Posted May 12, 2022 Share Posted May 12, 2022 1 hour ago, samowns said: use mysqli they aready are Quote Link to comment https://forums.phpfreaks.com/topic/314780-how-to-get-the-value-of-each-input-of-each-data-i-bring-from-the-db/#findComment-1596175 Share on other sites More sharing options...
ginerjm Posted May 12, 2022 Share Posted May 12, 2022 I don't know what samowns is trying to contribute to this very vague topic, but since the OP has apparently left the building, this may all be moot. Quote Link to comment https://forums.phpfreaks.com/topic/314780-how-to-get-the-value-of-each-input-of-each-data-i-bring-from-the-db/#findComment-1596177 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.