Jump to content

listing db content as a form.. need to make each unique with array.. ??


jwk811

Recommended Posts

I have products shown in my admin pages and they are shown listed in a form so each detail (price, name, etc.) is shown as a text input.. if i do this they will all have the same name when i submit it to update.. i figured i could make it an array somehow and then use foreach or implode to get it all and update it to the db like that.. understand? any help? thanks!

Link to comment
Share on other sites

lol sorry.. ill try to make it sound better.. i have a table on my db for products which includes name, price, etc... i have admin pages where i can set the price of each item.... in that page i need it to list all my products that i have saved into my db... to get the products on that page i do a mysql query to select everything in the table and then use

while($row = mysql_fetch_assoc($result)){
extract $row;

that way i now have the name and price of all my products and it will execute this code for all the products

<input type="text" name="name" value="<?php echo $name; ?>">

and same for the price.. since it will show all these products like this they will all have the same name and that wont work when i try to update it to the db. i was wondering if it would be possible to use an array to make each unique and i need to know how to submit it to the db afterwords

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.