kevincro Posted November 3, 2007 Share Posted November 3, 2007 I've written a form in html and use php to process it to my database. What I want to do is make it so that a person can choose a number and then by clicking submit it will create an amount of db entries that corresponds to the number that they chose. Quote Link to comment https://forums.phpfreaks.com/topic/75882-adding-multiple-entries-with-one-click/ Share on other sites More sharing options...
trq Posted November 3, 2007 Share Posted November 3, 2007 Are they all to be the same entry? Sorry, but that doesn't seem very usefull. Its easy enough though. <?php if (isset($_POST['num'])) { for ($i = 1;$i <= $_POST['num'];$i++) { if (mysql_query($sql)) { where $sql is your query. echo "Row $i added<br />"; } else { echo "Row $i failed<br />"; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/75882-adding-multiple-entries-with-one-click/#findComment-384075 Share on other sites More sharing options...
kevincro Posted November 3, 2007 Author Share Posted November 3, 2007 Well what I have is a system that allows people to offer items for sale to other members, With this I can allow the user to submit multiple entries for the amount of items of the same type. Each row represents an individual item. When a member purchases an item it places that row of data into a sold items db table and removes it from the list of available items. As it stands, user can submit multiple items but only by using their back button in their browser and clicking submit again and again. I feel that this is a very crude and potentially detrimental way of accomplishing this task. Thanks for the code. KC Quote Link to comment https://forums.phpfreaks.com/topic/75882-adding-multiple-entries-with-one-click/#findComment-384370 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.