Hey,
Here we go...
A form that lists the results of a database used for editing the information. The data is used to create menu links for the site. I have them stored (inside db) like "linkName:url:linkTitle"
I use explode() to seperate them all and voila. (Just giving background here).
When they are displayed back in the edit form, I have them set up like...
<?PHP
// QUERY DB
$getMENUQUERY = mySQL_QUERY ("SELECT * FROM blocks_sub WHERE block_id = '$bID'");
echo '<form action="index.php?do=fetch&mod=blocks&func=submit&type=edit&sub=menu" method="POST">'
.'<table cellpadding="1" cellspacing="0" align="center" class="sysBORDER_ALL">';
// LOOP THROUGH THE RESULTS
while ($menuBLOCK = mySQL_FETCH_ARRAY($getMENUQUERY)) {
// STORE THE DATA INTO AN ARRAY
$menuPIECES = explode(":",$menuBLOCK['block_value']);
// DISPLAY EACH BIT OF DATA INSIDE AN INPUT FIELD
echo '<tr>'
.'<td><input type="text" name="menu_title[]" value="'.$menuPIECES[2].'"></td>'
.'<td><input type="text" name="menu_url[]" value="'.$menuPIECES[0].'"></td>'
.'<td><input type="text" name="menu_alt[]" value="'.$menuPIECES[1].'"></td>'
.'</tr>'
.'<input type="hidden" name="menu_subID[]" value="'.$menuBLOCK['block_sid'].'">';
echo '</tr>'
}
echo '<tr>'
.'<td align="center" colspan="3">'
.'<span class="link-highlight">'
.'<input type="image" src="themes/'.$cur_theme.'/images/buttons/set_settings.gif" name="submit">'
.'</span>'
.'</td>'
.'</tr>'
.'</table>'
.'</form>';
?>
So I have the value's of each input field being store inside of an array. I'm not sure that it is right, I'm just testing things out right now.
When the form subits to the "submit function" (and this is where I'm getting all screwed up) this code happens.
<?PHP
$c_Title = count ($_POST['menu_title']);
$c_URL = count ($_POST['menu_url']);
$c_Alt = count($_POST['menu_alt']);
$c_ID = count($_POST['subID']);
// I'M ONLY GOING TO DO THE ID BECAUSE IT'S THE ONLY ONE THAT WORKS.
for ($i = 0; $i < $c_ID; $i ++) {
$cID = $_POST['menu_subID'][$i];
### MYSQL TO PERFORM ###
}
?>
I'm sorry for posting so much but the bare bones question in all of this is how do I get all of the posted data from the previous form and update it inside of the database?
Thank you very much in advance for your help.