On a previous thread, a member was nice enough to help me out. The script worked fine, until I added other variables. Now, it won't register in the database. My eyes are not working. Any ninjas? Thanks
reg.php
<?php
require( 'config.php' );
$con = mysql_connect( $mySQLhost,$mySQLuser,$mySQLpass ) or die( 'Error: ' . mysql_error() );
mysql_select_db( $mySQLdb );
$error = 0;
if ( isset( $_POST['submit'] ) ) {
array_map( 'mysql_real_escape_string',$_POST ); //Protects against SQL injection
foreach( $_POST as $key => $value ) {
if ( $value == '' ) {
$error++;
}
${$key} = $value;
}
if ( $error > 0 ) {
echo "One or more fields are missing information";
}
elseif ( $error == 0 ) {
$sql = "INSERT INTO {$mySQLtable} ('first','last','age','city','state','fifteen','fifteenl','fifteend','mile','milel','miled','fivek','fivekl','fivekd','tenk','tenkl','tenkd','half','halfl','halfd','full','fulll','fulld') VALUES ('{$first}','{$last}','{$age}','{$city}','{$state}','{$fifteen}','{$fifteenl}','{$fifteend}','{$mile}','{$milel}','{$miled}','{$fivek}','{$fivekl}','{$fivekd}','{$tenk}','{$tenkl}','{$tenkd}','{$half}','{$halfl}','{$halfd}','{$full}','{$fulll}','{$fulld}')";
$query = mysql_query( $sql,$con );
if ( $query ) {
echo $regSuccess;
}
else {
echo $regFailed;
}
}
}
echo '<p><a href="' . $pathList . '">View current list of participants</a></p>';
mysql_close( $con );
?>
index.php
<table>
<tr>
<td><label for="event" id="event" style="font-size:28px;padding-right:5px">1500m:</label><br /></td>
<td><label for="txtdistance">TIME:</label><br /><input type="text" name="fifteen" title="" id="time" size="5" class='input-text' /></td>
<td><label for="txttime">LOCATION:</label><br /><input type="text" name="fifteenl" title="" id="fifteenl" size="5" class='input-text' /></td>
<td><label for="txtlocation">DATE:</label><br /><input type="text" name="fifteend" title="" id="fifteend" size="5" class='input-text' /></td>
</tr>
<tr>
<td><label for="event" id="event" style="font-size:28px;padding-right:5px">Mile:</label><br /></td>
<td><label for="txtdistance">TIME:</label><br /><input type="text" name="mile" title="" id="time" size="5" class='input-text' /></td>
<td><label for="txttime">LOCATION:</label><br /><input type="text" name="milel" title="" id="milel" size="5" class='input-text' /></td>
<td><label for="txtlocation">DATE:</label><br /><input type="text" name="miled" title="" id="miled" size="5" class='input-text' /></td>
</tr>
<tr valign="top">
<td><label for="event" id="event" style="font-size:28px;padding-right:5px">5k:</label><br /></td>
<td><label for="txtdistance">TIME:</label><br /><input type="text" name="fivek" title="" id="time" size="5" class='input-text' /></td>
<td><label for="txttime">LOCATION:</label><br /><input type="text" name="fivekl" title="" id="fivekl" size="5" class='input-text' /></td>
<td><label for="txtlocation">DATE:</label><br /><input type="text" name="fivekd" title="" id="fivekd" size="5" class='input-text' /></td>
</tr>
<tr>
<td><label for="event" id="event"style="font-size:28px;padding-right:5px">10k:</label><br /></td>
<td><label for="txtdistance">TIME:</label><br /><input type="text" name="tenk" title="" id="time" size="5" class='input-text' /></td>
<td><label for="txttime">LOCATION:</label><br /><input type="text" name="tenkl" title="" id="tenkl" size="5" class='input-text' /></td>
<td><label for="txtlocation">DATE:</label><br /><input type="text" name="tenkd" title="" id="tenkd" size="5" class='input-text' /></td>
</tr>
<tr>
<td><label for="event" id="event" style="font-size:28px;padding-right:5px">13.1:</label><br /></td>
<td><label for="txtdistance">TIME:</label><br /><input type="text" name="half" title="" id="time" size="5" class='input-text' /></td>
<td><label for="txttime">LOCATION:</label><br /><input type="text" name="halfl" title="" id="halfl" size="5" class='input-text' /></td>
<td><label for="txtlocation">DATE:</label><br /><input type="text" name="halfd" title="" id="halfd" size="5" class='input-text' /></td>
</tr>
<tr>
<td><label for="event" id="event" style="font-size:28px;padding-right:5px">26.2:</label><br /></td>
<td><label for="txtdistance">TIME:</label><br /><input type="text" name="full" title="" id="time" size="5" class='input-text' /></td>
<td><label for="txttime">LOCATION:</label><br /><input type="text" name="fulll" title="" id="fulll" size="5" class='input-text' /></td>
<td><label for="txtlocation">DATE:</label><br /><input type="text" name="fulld" title="" id="fulld" size="5" class='input-text' /></td>
</tr>
</table>
I tried to make the table better organized. emphasis on "tried".
Thanks