HTML:
<script language='javascript'>
function verifyMe(){
var msg='';
if(document.getElementById('Artist').value==''){
msg+='- Artist\n\n';}
if(document.getElementById('Album').value==''){
msg+='- Album\n\n';}
if(document.getElementById('Song').value==''){
msg+='- Song\n\n';}
if(!document.getElementById('Guitar[0]').checked && !document.getElementById('Guitar[1]').checked && !document.getElementById('Guitar[2]').checked && !document.getElementById('Guitar[3]').checked){
msg+='- Guitar\n\n';}
if(!document.getElementById('Bass[0]').checked && !document.getElementById('Bass[1]').checked && !document.getElementById('Bass[2]').checked && !document.getElementById('Bass[3]').checked){
msg+='- Bass\n\n';}
if(!document.getElementById('Drums[0]').checked && !document.getElementById('Drums[1]').checked && !document.getElementById('Drums[2]').checked && !document.getElementById('Drums[3]').checked){
msg+='- Drums\n\n';}
if(document.getElementById('Download').value==''){
msg+='- Download\n\n';}
if(msg!=''){
alert('The following fields are empty or invalid:\n\n'+msg);
return false
}else{
return true }
}
</script>
<form name='SUBMIT' action='submit2.php' method='POST' enctype='application/x-www-form-urlencoded' onsubmit='return verifyMe();'>
<table cellspacing='0' border="0" width="100%">
<tr><td>
<fieldset class="fieldset">
<legend>Artist</legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<input type='text' name='Artist' id='Artist' size='50' maxlength='50' value=''>
</td>
</tr>
</table>
</fieldset>
<td></tr>
<tr><td>
<fieldset class="fieldset">
<legend>Album</legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<input type='text' name='Album' id='Album' size='50' maxlength='50' value=''>
</td>
</tr>
</table>
</fieldset>
<td></tr>
<tr><td>
<fieldset class="fieldset">
<legend>Song</legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<input type='text' name='Song' id='Song' size='50' maxlength='50' value=''>
</td>
</tr>
</table>
</fieldset>
<td></tr>
<tr><td>
<fieldset class="fieldset">
<legend>Guitar</legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<LABEL ACCESSKEY=''><input type='checkbox' name='Guitar[0]' id='Guitar[0]' value='1'></LABEL>Expert<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Guitar[1]' id='Guitar[1]' value='1'></LABEL>Hard<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Guitar[2]' id='Guitar[2]' value='1'></LABEL>Medium<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Guitar[3]' id='Guitar[3]' value='1'></LABEL>Easy<BR/>
</td>
</tr>
</table>
</fieldset>
<td></tr>
<tr><td>
<fieldset class="fieldset">
<legend>Bass</legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<LABEL ACCESSKEY=''><input type='checkbox' name='Bass[0]' id='Bass[0]' value='1'></LABEL>Expert<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Bass[1]' id='Bass[1]' value='1'></LABEL>Hard<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Bass[2]' id='Bass[2]' value='1'></LABEL>Medium<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Bass[3]' id='Bass[3]' value='1'></LABEL>Easy<BR/>
</td>
</tr>
</table>
</fieldset>
<td></tr>
<tr><td>
<fieldset class="fieldset">
<legend>Drums</legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<LABEL ACCESSKEY=''><input type='checkbox' name='Drums[0]' id='Drums[0]' value='1'></LABEL>Expert<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Drums[1]' id='Drums[1]' value='1'></LABEL>Hard<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Drums[2]' id='Drums[2]' value='1'></LABEL>Medium<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Drums[3]' id='Drums[3]' value='1'></LABEL>Easy<BR/>
</td>
</tr>
</table>
</fieldset>
<td></tr>
<tr><td>
<fieldset class="fieldset">
<legend>Download</legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<input type='text' name='Download' id='Download' size='50' maxlength='500' value='Download'>
</td>
</tr>
</table>
</fieldset>
<td></tr>
<tr><td align='right'>
<fieldset class="fieldset">
<legend></legend>
<table cellpadding="0" cellspacing="3" border="0" width="100%">
<tr>
<td>
<input type='submit' name='submit' value='Submit'> <input type='reset' name='reset' value='Reset'>
</td>
</tr>
</table>
</fieldset>
<td></tr>
</table>
</form>
<LABEL ACCESSKEY=''><input type='checkbox' name='Guitar[1]' id='Guitar[1]' value='1'></LABEL>Hard<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Guitar[2]' id='Guitar[2]' value='1'></LABEL>Medium<BR/>
<LABEL ACCESSKEY=''><input type='checkbox' name='Guitar[3]' id='Guitar[3]' value='1'></LABEL>Easy<BR/>
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>FOF-DB</title>
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include("./include/1.php"); ?>
<?php include("./include/2.php"); ?>
<div id="wrapper">
<?php include("./include/3.php"); ?>
<div id="col-two">
<div class="boxed">
<h2 class="title">STEP 3</h2>
<div class="content">
<p>
<?
$A=$_POST['Artist'];
$B=$_POST['Album'];
$C=$_POST['Song'];
$D=$_POST['Guitar[0]'];
$E=$_POST['Guitar[1]'];
$F=$_POST['Guitar[2]'];
$G=$_POST['Guitar[3]'];
$H=$_POST['Bass[0]'];
$I=$_POST['Bass[1]'];
$J=$_POST['Bass[2]'];
$K=$_POST['Bass[3]'];
$L=$_POST['Drums[0]'];
$M=$_POST['Drums[1]'];
$N=$_POST['Drums[2]'];
$O=$_POST['Drums[3]'];
$P=$_POST['Download'];
mysql_connect("localhost", "", "") or die(mysql_error());
mysql_select_db("") or die(mysql_error());
mysql_query("INSERT INTO `ARTIST` (`id` ,`ARTIST`) VALUES (NULL , '$A');");
mysql_query("INSERT INTO `ALBUM` (`ID` ,`ARTIST` ,`ALBUM` ,`YEAR` ,`ART` ) VALUES (NULL , '$A', '$B', '', '');");
mysql_query("INSERT INTO `SONG` (`ID` ,`ARTIST` ,`ALBUM` ,`SONG` ,`DISC` ,`TIME` ,`TRACK` ,`CAREER` ,`TIER` ,`DOWNLOAD` ,`GX` ,`GH` ,`GM` ,`GE` ,`BX` ,`BH` ,`BM` ,`BE` ,`DX` ,`DH` ,`DM` ,`DE` )VALUES (NULL , '$A', '$B', '$C', 'NULL', 'NULL', 'NULL', NULL , NULL , '$P', '$D', '$E', '$F', '$G', '$H', '$I', '$J', '$K', '$L', '$M', '$N', '$O');");
Print "SONG HAS BEEN SUBMITED";
?>
</p>
</div>
</div>
</div>
<?php include("./include/4.php"); ?>
</div>
<?php include("./include/5.php"); ?>
</body>
</html>
$E=$_POST['Guitar[1]'];
$F=$_POST['Guitar[2]'];
$G=$_POST['Guitar[3]'];
I want it to inset a 1 into the rows where a checkbox is checked and a 0 if not checked
Last edited: