I know how to post multiple rows using a if and foreach loop. I can post multiple rows from one form.
here is the form snippet.....
<tr>
<td><input name="entry[0][place]" type="text" /></td>
<td><input name="entry[0][team]" type="text" /></td>
<td><input name="entry[0][wl]" type="text" /></td>
<td><input name="entry[0][gb]" type="text" /></td>
<td><input name="entry[0][pcage]" type="text" /></td>
<td><input name="entry[0][rs]" type="text" /></td>
<td><input name="entry[0][ra]" type="text" /></td>
<td><input name="entry[0][ags]" type="text" /></td>
</tr>
<tr>
<td><input name="entry[1][place]" type="text" /></td>
<td><input name="entry[1][team]" type="text" /></td>
<td><input name="entry[1][wl]" type="text" /></td>
<td><input name="entry[1][gb]" type="text" /></td>
<td><input name="entry[1][pcage]" type="text" /></td>
<td><input name="entry[1][rs]" type="text" /></td>
<td><input name="entry[1][ra]" type="text" /></td>
<td><input name="entry[1][ags]" type="text" /></td>
</tr>
<tr>
<td><input name="entry[2][place]" type="text" /></td>
<td><input name="entry[2][team]" type="text" /></td>
<td><input name="entry[2][wl]" type="text" /></td>
<td><input name="entry[2][gb]" type="text" /></td>
<td><input name="entry[2][pcage]" type="text" /></td>
<td><input name="entry[2][rs]" type="text" /></td>
<td><input name="entry[2][ra]" type="text" /></td>
<td><input name="entry[2][ags]" type="text" /></td>
</tr>
here is the code that post it as an array of data.....
$mysql = mysql_connect($hostname, $username, $password);
mysql_select_db($database);
//? for php engine
if (isset($_POST['btnSub']))
{
//check for records later i
$sql = "INSERT INTO major (place,team, wl, gb, pcage, rs, ra, ags) VALUES\n ";
foreach ($_POST['entry'] as $data)
{
$dataArray[] = "('" . join ("','", $data) . "')";
}
$sql .= join (",\n", $dataArray);
/*echo '<pre>', $sql, '</pre>'; */ // view query
mysql_query($sql) or die(mysql_error());
header("location:ft7tinput.html");
}
How can I edit the form I tried this........
<tr>
I did this so you know what I'm trying to target....
<td><input value="<?php echo $data[0] ?>" "name="entry[0][place]" type="text" /></td>
Ok I tried to use the same if and foreach loop to edit the rows...........
<td><input name="entry[0][team]" type="text" /></td>
<td><input name="entry[0][wl]" type="text" /></td>
<td><input name="entry[0][gb]" type="text" /></td>
<td><input name="entry[0][pcage]" type="text" /></td>
<td><input name="entry[0][rs]" type="text" /></td>
<td><input name="entry[0][ra]" type="text" /></td>
<td><input name="entry[0][ags]" type="text" /></td>
</tr>
<tr>
<td><input name="entry[1][place]" type="text" /></td>
<td><input name="entry[1][team]" type="text" /></td>
<td><input name="entry[1][wl]" type="text" /></td>
<td><input name="entry[1][gb]" type="text" /></td>
<td><input name="entry[1][pcage]" type="text" /></td>
<td><input name="entry[1][rs]" type="text" /></td>
<td><input name="entry[1][ra]" type="text" /></td>
<td><input name="entry[1][ags]" type="text" /></td>
</tr>
<tr>
<td><input name="entry[2][place]" type="text" /></td>
<td><input name="entry[2][team]" type="text" /></td>
<td><input name="entry[2][wl]" type="text" /></td>
<td><input name="entry[2][gb]" type="text" /></td>
<td><input name="entry[2][pcage]" type="text" /></td>
<td><input name="entry[2][rs]" type="text" /></td>
<td><input name="entry[2][ra]" type="text" /></td>
<td><input name="entry[2][ags]" type="text" /></td>
</tr>
Here is the edit code......
//? for php engine
if (isset($_GET['btnSub']))
{
//check for records later i
$sql = "SELECT FROM major (place,team, wl, gb, pcage, rs, ra, ags) VALUES\n ";
foreach ($_GET['entry'] as $data)
{
$dataArray[] = "('" . join ("','", $data) . "')";
}
$sql .= join (",\n", $dataArray);
/*echo '<pre>', $sql, '</pre>'; */ // view query
mysql_query($sql) or die(mysql_error());
header("location:ft7tinput.html");
}
How do I edit rows using the same form?