Php Mysql Multiple Checkbox Update
Join Stack Overflow to learn, share knowledge, and build your career.
Getting somewhere. I have renamed checkboxes to have equal names like you suggested. Also I have used this for query: $langid2[]=$_POST['enabledLanguages']; $langids = implode(',', $langid2); $q='UPDATE language SET enabled= lang_id IN($langids) >0'; The result is that it remembers checked box but deletes others. For instance, I have languages English, German, Croatian, French. If I check English and update all is ok. So on the page load it loads English as checked.
Second update for German checked updates German language but clears English (or any other). How to keep those checked values? – Oct 12 '12 at 13:43 •.
Am taking the name as name=type[].in the form of array.but on checking it the result in the database simply gives the world 'array' You have surely answered your own question. If it is an array, and you insert an array you will get an array. You can't expect MySql to handle this as you expect? [PHP]$query ='insert into form (type,other,purpose)VALUES('$type','$other','$purp ose')';[/PHP] The above query either needs to be executed multiple times with a single value in place of $type', or you need to constrct a multiple values INSERT query. Phpstorm Mac Keygen Cs4 here. Its good.thanx for your solution.it has started inserting checkbox values into mysql database.I guess you are very good at php. I have been wondering for this solution but all in vain until you gave the right answer.Thanx once again.
However still there is another problem.The multiple checked data has started to be inserted into the mysql database.Now in the next page if i want to update those checked data from some new checked data,in that case can you please show some light. I mean to say that when i open the edit page,at first the earlier checked data be visible.After that when i check some other data in the checkbox and click the submit buttton,in the database this updated data should be visible. It would be great to seek your help Thanx and Regards TechnoAtif. However still there is another problem. The description that follows is not a problem, it is a requirement for a full script. I'm sorry I just don't have time for that. But basically you can pass data from the current script in the same way.
The new script needs a SELECT query reading the current data from the database. This data needs displaying in text boxes so it can be edited. Then a Submit button calls the same scipt but is directed to code that can UPDATE the database first with the new data.
Then the same code that generates the SELECT above query runs again displaying the new data. It can all be done in one script with one form and one submit button. If you make a start I can help. Hi CodeGreen!!! Thanx for the reply yes i have tried that but the checked sates of the checkboxes is still not visible. I want the entry of those checked boxes to be made alog with other items.for example.textfield,text area,radiobuttons.etc. If i update the check boxes ina separate form where i have only checkboxes then it may work but along with the other items i just get messed up.eg [PHP]update form set check='$check', design='$design'...where id='$id'[/PHP] do i have to take chekbox entries in a separate table.i want to make the entry of all the form items through the same query and in the same table.
Please help.if u 'll say then i can post the code also. 1.install And Enable A Php Accelerator Like Apc Highly Recommended. but its is so lengthy that u will loose yourself in it. Thats why if you can help me with a fresh code.that could be a combination of more than items.i.e. Listboxes,textfield checkboxes.etc and not only of checkboxes, it would be more than convenient for me.
Thanx and Regards TechnoAtif. I don't understand your problem. Now the main problem,as i earlier mentioned is,how to make the checked status of the checkbox visible in the next page. If checked they are passed through the POST array. You read the POST variables and re-create the checkboxes while updating the data Which data where? I want that as i open the update/edit form the already cheked checkboxes be displayed Are you trying to pass the values from one page to another or get the values from a database?
And later on i could update them by cecking on some other or the same checkbox You can only check or uncheck a checkbox. Healthpointe 2 0 Program Pro. This updated data should also be updated i the datanase. What updated data. We are looking at checkboxes. Using the same table and array now these checkboxes are to be updated Again, what do you mean by updated? Hi, Sorry to just wade in on this but I think I understand what TechnoAtif is after.