I seem to run into a problem every 2 seconds of coding . . .
Here is my current issue.
For some reason my form is not submitting. Zend Studio didn't pick up any errors or anything.
So here is my submit code :
<?
require("config.php"); ///// Configuration
require(INC_DIR.INC_PREFIX."dbconnect.php"); ///// Database Connection
require(INC_DIR.INC_PREFIX."functions.php"); ///// Functions Include
login_check(); ///// Login Check
adminlogin_check(); ///// Admin Login Check
switch ($_site_Hub) {
case 'nhl':
require(NHL_DIR.NHL_PREFIX."config.php"); ///// NHL Configuration
break;
}
##### Handle Submit Data
if (isset($_POST['submit']))
{
$message=NULL;// Empty variable
$xHub=$_POST['xHub'];
///// Loop through all submitted variables
for ($i=1;$i<count($_POST['xID'][$i])+1;$i++) {
///// Set ID
$xID=$_POST['xID'][$i];
///// Check and Set Name
if (empty($_POST['xName'][$i])) {
$xName=FALSE;
$message .='You forgot to enter name for row '.$i.'.<br>';
} else {
$xName=escape_data($_POST['xName'][$i]);
}
///// Set Type
$xType=$_POST['xType'][$i];
///// Check Type and Set Value
if ($xType==1) {
$xValue=strtotime($_POST['xValue'][$i]);
}else{
$xValue=escape_data($_POST['xValue'][$i]);
}
///// If all variables checked out
if ($xID && $xName && $xValue && $xType) {
///// Check and Set VarOK
if ($VarOK!=FALSE) {
$VarOK=TRUE;
}
///// Make query
$query_update[]="UPDATE
".$xHub."_config
SET
config_name='$xCity',
config_value='$xSymbol',
config_type='$xType'
WHERE
config_id='$xID'";
}
for ($i=1;$i<count($query_update)+1;$i++) {
echo $query_update[$i];
}
}
} else {
$VarOK=FALSE;
}
##### Insert Data into DB, if VarOK checks out
if ($VarOK)
{
for ($i=1;$i<count($query_update)+1;$i++) {
$result=mysql_query($query_update[$i]); ///// Run the query
if ($result) {
if ($QueOK!=FALSE) {
$QueOK=TRUE;
}
}else{
$QueOK=FALSE;
}
}
if ($QueOK) ///// If the query ran OKAY
{
///// Set redirect
$message.="Changes have been successfully updated.";
} else {
///// If the query had errors
$message.='Changes could not be made due to a system error.<br>';
$message.='We apologize for any inconvenience.<br>';
$message.=mysql_error();
}
}else{
$message.="VarOK is not okay.<br>"; ///// For testing only
}
///// Beginning of output
$_site_Page='Edit Config Variables'; ///// Title
require(INC_DIR.INC_PREFIX."header.php"); ///// Header including top navigation
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<?
if (isset($_site_Hub)) {
$query="SELECT * FROM ".$_site_Hub."_config";
echo '<input type="hidden" name="xHub" value="'.$_site_Hub.'"/>';
}else{
$query="SELECT * FROM site_config";
echo '<input type="hidden" name="xHub" value="site"/>';
}
$result=@mysql_query($query); ///// Run the query
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" height="22" id="innertopleft"> </td>
<td height="22" id="innertopmid" align="center"><font color="<?=color_switch(5);?>"><b id="lgtext">
<?
echo $_site_Page;
if (!empty($_site_Section)) {echo ' : <i>'.$_site_Section.'</i>';}
?>
</b></font></td>
<td width="10" height="22" id="innertopright"> </td>
</tr>
<tr>
<td width="10" id="innermidleft"> </td>
<td id="innermidmid">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<!-- Required Fields -->
<tr>
<td> </td>
<td><b><u>Name</u></b></td>
<td><b><u>Value</u></b></td>
<td><b><u>Input Type</u></b></td>
</tr>
<?
while ($row=mysql_fetch_array($result, MYSQL_NUM)){
echo'<tr>
<td align="center"><input type="hidden" name="xID['.$row[0].']" value="'.$row[0].'"/>'.$row[0].'</td>
<td><input type="text" name="xName['.$row[0].']" size="25" maxlength="25" value="'.$row[1].'" id="input"/></div></td>
<td><input type="text" name="xValue['.$row[0].']" size="35" maxlength="100" value="'.$row[2].'" id="input"/></div></td>
<td>
<select name="xType['.$row[0].']" size="1" id="inputb">
<option value="0" ';
if (($row[3]==0)) {echo ' selected';}
echo '>Plain Text (default)</option>
<option value="1" ';
if (($row[3]==1)) {echo ' selected';}
echo '>Date</option>
</select>
</td>
</tr>';
}
?>
<tr>
<td align="center"><input type="hidden" name="xNewID" value="0"/>new</td>
<td><input type="text" name="xNewName" size="25" maxlength="25" value="" id="input"/></div></td>
<td><input type="text" name="xNewValue" size="35" maxlength="100" value="" id="input"/></div></td>
<td>
<select name="xNewType" size="1" id="inputb">
<option value="0">Plain Text (default)</option>
<option value="1">Date</option>
</select>
</td>
</tr>
</table>
<hr width="100%" size="1" id="mainhr">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td colspan="2"><div align="right"><input type="submit" name="submit" value="Save Changes » »" id="inputb"/></div></td>
</tr>
</table>
</td>
<td width="10" id="innermidright"> </td>
</tr>
<tr>
<td width="10" height="22" id="innerbotleft"> </td>
<td height="22" id="innerbotmid"> </td>
<td width="10" height="22" id="innerbotright"> </td>
</tr>
</table>
</form>
<?
require(INC_DIR.INC_PREFIX."footer.php"); ///// Footer including bottom navigation
?>