943,871 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 495
  • PHP RSS
Apr 8th, 2009
0

Insert only selected result records in database

Expand Post »
Hi all,

I am getting result in an array from some webservice and i have created User Interface to see these results with each result have a check box with it.

what i want to do is to insert only that record in DB that user will check in check box.

Is there any way to do that.

PHP Syntax (Toggle Plain Text)
  1. <tr>
  2. <td align='center'><input type='checkbox' name='chk0' value=''/></td>
  3. <td align='center'>1</td>
  4. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  5. <td align='center'>4</td>
  6. <td align='center'>100</td></tr>
  7. <tr>
  8. <td align='center'><input type='checkbox' name='chk1' value=''/></td>
  9. <td align='center'>66</td>
  10. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  11. <td align='center'>66</td>
  12. <td align='center'>40</td></tr>
  13. <tr>
  14. <td align='center'><input type='checkbox' name='chk2' value=''/></td>
  15. <td align='center'>99</td>
  16. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  17. <td align='center'>19</td>
  18. <td align='center'>167</td></tr>
  19. <tr>
  20. <td align='center'><input type='checkbox' name='chk3' value=''/></td>
  21. <td align='center'>6</td>
  22. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  23. <td align='center'>44</td>
  24. <td align='center'>555</td></tr>

User will check the check box against the record they want to insert in db and hit submit button.so all those records will go in db.there are four fields in Db table.

Thanks in advance.
jyotiu
Last edited by jyotiu; Apr 8th, 2009 at 10:41 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
jyotiu is offline Offline
33 posts
since Sep 2008
Apr 8th, 2009
0

Re: Insert only selected result records in database

When you call the the Database, are you using a SELECT statement and a WHERE clause?? If so, what is it?
Reputation Points: 8
Solved Threads: 6
Posting Whiz in Training
extofer is offline Offline
239 posts
since Aug 2005
Apr 9th, 2009
0

Re: Insert only selected result records in database

Click to Expand / Collapse  Quote originally posted by jyotiu ...
Hi all,

I am getting result in an array from some webservice and i have created User Interface to see these results with each result have a check box with it.

what i want to do is to insert only that record in DB that user will check in check box.

Is there any way to do that.

PHP Syntax (Toggle Plain Text)
  1. <tr>
  2. <td align='center'><input type='checkbox' name='chk0' value=''/></td>
  3. <td align='center'>1</td>
  4. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  5. <td align='center'>4</td>
  6. <td align='center'>100</td></tr>
  7. <tr>
  8. <td align='center'><input type='checkbox' name='chk1' value=''/></td>
  9. <td align='center'>66</td>
  10. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  11. <td align='center'>66</td>
  12. <td align='center'>40</td></tr>
  13. <tr>
  14. <td align='center'><input type='checkbox' name='chk2' value=''/></td>
  15. <td align='center'>99</td>
  16. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  17. <td align='center'>19</td>
  18. <td align='center'>167</td></tr>
  19. <tr>
  20. <td align='center'><input type='checkbox' name='chk3' value=''/></td>
  21. <td align='center'>6</td>
  22. <td align='center'>Dell Home_GenericLogo 88x31&nbsp;</td>
  23. <td align='center'>44</td>
  24. <td align='center'>555</td></tr>

User will check the check box against the record they want to insert in db and hit submit button.so all those records will go in db.there are four fields in Db table.

Thanks in advance.
jyotiu


PHP Syntax (Toggle Plain Text)
  1.  
  2. change your name='chk0'
  3.  
  4. into an array name=chk[]
  5.  
  6. call all the values from this code.
  7.  
  8. $chk=$_POST['chk'];
  9.  
  10. while (list ($key,$val) = @each ($chk)) {
  11. echo "$val,";
  12. }
  13.  
  14. you can manipulate your values for every checkbox.
Reputation Points: 13
Solved Threads: 12
Junior Poster
rm_daniweb is offline Offline
165 posts
since Jan 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Confirmation dialog box for delete
Next Thread in PHP Forum Timeline: PHP and Sql question





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC