Hello I got one problem. I have a site where people can add movies.
Its possible to add up to 10 different hosts.
Every host can have up to 2 parts.
html
<TABLE>
<TR><TD width=120>Hoster*:</TD>
<TD>
<SELECT class="interfaceforms" name="addmovie[][hoster]"><OPTION value="">Please select</OPTION>
<?PHP
foreach($hoster_list AS $aKey => $aValue) {
echo'<option value="'.$aKey.'">'.$aValue.'</option>';
}
?>
</SELECT>
</TD>
</TR>
<TR>
<TD>
<BR><a href="#" onClick="document.getElementById('addhoster2').style.display='';return false;">>Add hoster<</a>
</TD>
<TD>
Part 1: <INPUT class="interfaceforms" type="text" name="addmovie[][part]"> link or embed code<BR>
Part 2: <INPUT class="interfaceforms" type="text" name="addmovie[][part]"><BR>
</TD>
</TR>
</TABLE>
<TABLE id="addhoster2" style="display:none;">
<TR>
<TD width=120>Hoster*:</TD>
<TD>
<SELECT class="interfaceforms" name="addmovie[][hoster]"><OPTION value="">Please select</OPTION>
<?PHP
foreach($hoster_list AS $aKey => $aValue) {
echo'<option value="'.$aKey.'">'.$aValue.'</option>';
}
?>
</SELECT>
</TD>
</TR>
<TR>
<TD>
<BR><a href="#" onClick="document.getElementById('addhoster3').style.display='';return false;">>Add hoster<</a>
</TD>
<TD>
Part 1: <INPUT class="interfaceforms" type="text" name="addmovie[][part]"> link or embed code<BR>
Part 2: <INPUT class="interfaceforms" type="text" name="addmovie[][part]"><BR>
</TD>
</TR>
</TABLE>
<TABLE id="addhoster3" style="display:none;">
<TR>
<TD width=120>Hoster*:</TD>
<TD>
<SELECT class="interfaceforms" name="addmovie[][hoster]"><OPTION value="">Please select</OPTION>
<?PHP
foreach($hoster_list AS $aKey => $aValue) {
echo'<option value="'.$aKey.'">'.$aValue.'</option>';
}
?>
</SELECT>
</TD>
</TR>
<TR>
<TD>
<BR><a href="#" onClick="document.getElementById('addhoster4').style.display='';return false;">>Add hoster<</a>
</TD>
<TD>
Part 1: <INPUT class="interfaceforms" type="text" name="addmovie[][part]"> link or embed code<BR>
Part 2: <INPUT class="interfaceforms" type="text" name="addmovie[][part]"><BR>
</TD>
</TR>
</TABLE>
code
if(isset($_POST['submit']) && $_POST['submit']=="Add") {
$result = $_POST["addmovie"];
if (count($result > 0))
$new = array();
foreach ($result as $key => $value)
{
$new[] = "('" . $value["hoster"] . "', '" . $value["part"] . "', '" . $value["part"] . "')";
}
if (count($new) > 0)
{
$query = mysql_query("INSERT INTO topmovies.movies2 (hoster, part_1, part_2) VALUES " . implode(', ', $new));
if ($query)
{
echo 'SUCCESS';
}
else
{
echo 'FAILED';
}
}
}
Picture homepage:
http://s14.directupload.net/images/130805/ti4fwh7c.jpg
Picture database( so you see the problem )
http://s7.directupload.net/images/130805/n3kou9zo.jpg
As you see, the part are not on the same row as the hoster and there should be only 1 row each host and not 2
Would be happy if someone can help out :)