| | |
Updating selected Checkbox problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 496
Reputation:
Solved Threads: 0
Hi,
When i click one checkbox code below workes fine but, more than one, noo. I cant find the problem. Can you help me please?
Thnaks
1st page.
2nd page.
When i click one checkbox code below workes fine but, more than one, noo. I cant find the problem. Can you help me please?
Thnaks
1st page.
PHP Syntax (Toggle Plain Text)
<td><input type="checkbox" name="checkboxReceipt<?php echo "[$newArray[id]]"; ?>" value="<?php echo $newArray['id']; ?>" id="checkboxReceipt"></td>
2nd page.
PHP Syntax (Toggle Plain Text)
if (isset($_POST['checkboxReceipt'])){ $sql="UPDATE payment SET"; foreach ($_POST['checkboxReceipt'] as $key=>$value) $sql.=" Ref='xxx', date='xx-xx-xxxx' WHERE id='$checkedReceipt[$key]',"; $sql=substr($sql,0,-1); $sql.=";"; $run = mysql_query($sql);
i think you have use check box in this way....
php Syntax (Toggle Plain Text)
<input name="checkboxReceipt[]" value="<?php echo $frow['id']; ?>" type="checkbox" />
Last edited by Shanti Chepuru; Aug 4th, 2008 at 4:23 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
•
•
Join Date: Apr 2008
Posts: 496
Reputation:
Solved Threads: 0
Solved with code below.
PHP Syntax (Toggle Plain Text)
foreach ($checkedReceipt as $key=>$value) { $sql="UPDATE payment SET Ref='xxx', date='xxxx-xx-xx' WHERE id='$checkedReceipt[$key]'"; $run = mysql_query($sql);
![]() |
Similar Threads
- I NEED HELP PLEASE:Warning: mysql_num_rows(): (PHP)
- I NEED HELP PLEASE:Warning: mysql_num_rows(): (MySQL)
- I have a virus or Trojan? (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: portal design help!!!!
- Next Thread: [urgent]Searching the static site...
| Thread Tools | Search this Thread |
advanced apache api array basics beginner binary broken cakephp check checkbox class cms code codingproblem combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert ip javascript job joomla js limit link login mail menu mlm mobile multiple mysql nodes oop outofmemmory paging parse password paypal pdf php problem procedure query radio random recursion remote script search server sessions smarty sms source space sql stored syntax system table traffic tutorial unicode up-to-date update upload url validation validator variable video web webapplications youtube






