lastgame2007 Posted March 17, 2012 Share Posted March 17, 2012 Hi i'am try to insert multiple data on a single submit, but i'm a total noob to Arrays, can any one help me out here... one of the members send me this out, but still i can figure it out how to insert the fields onto my database. it inserts but doesnt get the valuee.. Please help! if(isset($_POST['save'])) { unset($_POST['save']); $i = count($_POST['id']); $x = 0; for($x=0; $x <$i;$x++){ foreach($_POST as $data =>$d){ echo $data.'-'.$d[$x].'<br/>'; $insert = mysql_query("insert into tbl_grades"); //sql statement here (example): insert into table name (value of $data) values( value of$d[$x]) -- can anyone help me with this , how can i query to get the value of this, //HOW DO I MAKE MY SQL QUERY TO SAVE THIS OUT, I KNOW THIS IS MY PROBLEM IN THE QUERY.... here's my HTML <input name="id[]" type="hidden" value="<?php echo $row['id'];?>" /> 1st<input name="fg[]" type="text" id="fg[]" size="1" value="<?php $g_sub['sub_id'];?>"/> 2nd<input name="sg[]" type="text" id="sg[]" size="1" value="<?php $g_sub['sub_id'];?>"/> 3rd<input name="tg[]" type="text" id="tg[]" size="1" value="<?php $g_sub['sub_id'];?>"/> 4th <input name="forg[]" type="text" id="forg[]" size="1" value="<?php $g_sub['sub_id'];?>"/> ---- sub_id stands for subject id Quote Link to comment https://forums.phpfreaks.com/topic/259096-help-w-arrays/ Share on other sites More sharing options...
scootstah Posted March 17, 2012 Share Posted March 17, 2012 Please post the output of the query SHOW CREATE TABLE tbl_grades; You can run this in any MySQL client (such as the mysql CLI tool, phpMyAdmin, Workbench, etc). Also, I'm a little confused with your HTML markup. You have 5 checkboxes with different names yet you are using the array syntax in the name. What exactly are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/259096-help-w-arrays/#findComment-1328381 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.