My form buttons don't work. They use too, but they don't anymore. I am positive that the code use to work. what happens is when I click the submit button for $getCustomers == 'Edit' it returns a blank page instead of the results. On another page I have (people fill in Cusomter information, then click on the button and it sends the result to a mySQL database), when you click the submit button, it sends the results to the mySQL database like it's supposed to, but the page stays the same and doesn't change. It is suppose to go to a confirmation page. Once again, I am positive that it use to work. Now it doesn't (kinda like black magic 🙁 )
here's the whole code for the page:
<?php
include("menuitem.php");
include("focus.php");
print("<body bgcolor=\"C0C0C0\">");
include("../dbconnectadmin.php");
if($edit == 'continue')
{
print("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\">
<tr><td colspan=\"3\" bgcolor=\"#00FF00\" valign=\"center\" align=\"center\"><h3>Add Customers</h3></td></tr>
<tr><td><br></td></tr>");
$query1 = "update customers set compName = '$compName', custName = '$custName', custAddress = '$custAddress', custCity = '$custCity', custPhone = '$custPhone', custState = '$custState', custZipOne = '$custZipOne', custZipTwo = '$custZipTwo', custcomments = '$custcomments', custItems = '$octopus' where custPhone = '$custPhone'";
$mysql_result1 = mysql_query($query1, $mysql_link);
$query2 = "select * from customers where custPhone = '$custPhone'";
$mysql_result2 = mysql_query($query2, $mysql_link);
while($row2 = mysql_fetch_row($mysql_result2))
{
printf("<tr><td>%s<br>%s<br>%s</td><td>%s<br>%s, %s %s</td></tr>", $row2[1], $row2[5], $row2[2], $row2[3], $row2[4], $row2[6], $row2[7]);
}
print("</table>");
print("<a href=\"./editCustomer.php\">Edit More</a>");
}
else
{
if($editCustomer == 'Edit')
{
if((!$custPhone) OR (!$compName))
{
print("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\">
<tr><td colspan=\"3\" bgcolor=\"#FF0000\" valign=\"center\" align=\"center\"><h3>Edit Customers</h3></td></tr>
<tr><td><br></td></tr>
<tr><td><h4>Please Fill in All Fields Marked With An *</h4></td></tr></table>
<br><input type=button value=\"Back\" onClick=\"history.go(-1)\">");
}
else
{
//Get List
//Get Checkbox Value
$real_count = ($countcategories - 1);
$counts = 0;
$octopus = "";
while($counts <= $real_count)
{
$zebra = ${'category'.$counts};
if($zebra == "")
{
$counts++;
}
else
{
$octopus = "$octopus $zebra";
$counts++;
}
}
$query = "select * from customers where custPhone = '$custPhone'";
$mysql_result = mysql_query($query, $mysql_link);
if(mysql_affected_rows() != 0)
{
print("
<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\">
<tr><td colspan=\"3\" bgcolor=\"#FF0000\" valign=\"center\" align=\"center\"><h3>Edit Customers</h3></td></tr>
<tr><td><br></td></tr>
<tr><td><h4>This Custmer Seems To Already Exist! Do You Want To Overwrite?</h4></td></tr>");
while($row = mysql_fetch_row($mysql_result))
{
printf("<tr><td>%s<br>%s<br>%s</td><td>%s<br>%s, %s %s</td></tr>", $row[1], $row[5], $row[2], $row[3], $row[4], $row[6], $row[7]);
}
print("</table>
<a href=\"javascript:history.go(-1)\">NO</a><br>");
//<input type=button value=\"NO\" onClick=\"history.go(-1)\"><br>
//<SCRIPT LANGUAGE=\"JavaScript\">
//function goToURL3() { window.location = \"./editCustomer.php?edit=continue&compName=$compName&custName=$custName&custAddress=$custAddress&custCity=$custCity&custState=$custState&custZipOne=$custZipOne&custZipTwo=$custZipTwo&custPhone=$custPhone&custcomments=$custcomments&octopus=$octopus\"; }
//</script>
//<form>
//<input type=button value=\"YES\" onClick=\"goToURL3()\">
//</form>
print("<a href=\"./editCustomer.php?edit=continue&compName=$compName&custName=$custName&custAddress=$custAddress&custCity=$custCity&custState=$custState&custZipOne=$custZipOne&custZipTwo=$custZipTwo&custPhone=$custPhone&custcomments=$custcomments&octopus=$octopus\">YES</a>");
}
}
}
else
{
if($getCustomer == 'Edit')
{
$query = "select * from customers where custPhone = '$custPhone'";
$mysql_result = mysql_query($query, $mysql_link);
while($row = mysql_fetch_row($mysql_result))
{
//Account Input
print("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\">");
//Header
print("<tr><td colspan=\"3\" bgcolor=\"#00FF00\" valign=\"center\" align=\"center\"><h3>Edit Customers</h3></td></tr>");
//Start Form
print("<form action=\"$PHP_SELF\" method=\"post\">");
print("<tr>
<td valign=\"top\">");
//Column One
printf("<font size=\"2\">Fill in all field marked with an *.</font>
<h5>*Company Name:</h5>
<input type=\"text\" name=\"compName\" value=\"%s\">
<h5>Customer Name:</h5><input type=\"text\" name=\"custName\" value=\"%s\">
<h5>Customer Address:</h5>Street: <input type=\"text\" name=\"custAddress\" value=\"%s\"><br>
City: <input type=\"text\" name=\"custCity\" value=\"%s\"><br>
State: <select name=\"custState\">", $row[1], $row[2], $row[3], $row[4]);
printf("
//States
<option value=\"%s\">%s</option>", $row[6], $row[6]);
print("<option value=\"AL\">AL</option><option value=\"AK\">AK</option>
<option value=\"AZ\">AZ</option><option value=\"AR\">AR</option><option value=\"CA\">CA</option>
<option value=\"CO\">CO</option><option value=\"CT\">CT</option><option value=\"DE\">DE</option>
<option value=\"DC\">DC</option><option value=\"FL\">FL</option><option value=\"GA\">GA</option>
<option value=\"HI\">HI</option><option value=\"ID\">ID</option><option value=\"IL\">IL</option>
<option value=\"IN\">IN</option><option value=\"IA\">IA</option><option value=\"KS\">KS</option>
<option value=\"KY\">KY</option><option value=\"LA\">LA</option><option value=\"ME\">ME</option>
<option value=\"MD\">MD</option><option value=\"MA\">MA</option><option value=\"MI\">MI</option>
<option value=\"MN\">MN</option><option value=\"MS\">MS</option><option value=\"MO\">MO</option>
<option value=\"MT\">MT</option><option value=\"NE\">NE</option><option value=\"NV\">NV</option>
<option value=\"NH\">NH</option><option value=\"NJ\">NJ</option><option value=\"NM\">NM</option>
<option value=\"NY\">NY</option><option value=\"NC\">NC</option><option value=\"ND\">ND</option>
<option value=\"OH\">OH</option><option value=\"OK\">OK</option><option value=\"OR\">OR</option>
<option value=\"PA\">PA</option><option value=\"PR\">PR</option><option value=\"RI\">RI</option>
<option value=\"SC\">SC</option><option value=\"SD\">SD</option><option value=\"TN\">TN</option>
<option value=\"TX\">TX</option><option value=\"UT\">UT</option><option value=\"VT\">VT</option>
<option value=\"VI\">VI</option><option value=\"VA\">VA</option><option value=\"WA\">WA</option>
<option value=\"WV\">WV</option><option value=\"WI\">WI</option><option value=\"WY\">WY</option>
</select>");
printf("Zip: <input type=\"text\" name=\"custZipOne\" size=\"5\" value=\"%s\">-<input type=\"text\" name=\"custZipTwo\" size=\"4\" value=\"%s\">
<h5>*Customer Phone#:</h5><input type=\"text\" name=\"custPhone\" size=\"10\" value=\"%s\">", $row[7], $row[8], $row[5]);
//Column Two
printf("</td><td valign=\"top\">
<h5>Account Comments:</h5><textarea name=\"custcomments\" rows=\"5\" cols=\"28\">%s</textarea>", $row[9]);
print("<h5>Items Sold:</h5>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>");
$row_printed = 0;
$total_cols = 3;
$countcategories = 0;
$categories = "select * from categories";
$categories_result = mysql_query($categories, $mysql_link);
while($categories_row = mysql_fetch_row($categories_result))
{
if($row_printed == $total_cols)
{
print("</tr><tr>");
$row_printed = 0;
}
$explode = explode(" ", $row[10]);
$count = count($explode);
$countexit = 0;
$countexplode = 1;
while($countexit <= $count)
{
$explodenow = $explode[$countexplode];
if($explodenow == $categories_row[1])
{
printf("<td><input type=\"checkbox\" name=\"category%s\" value=\"%s\" checked>%s</td>", $countcategories, $categories_row[1], $categories_row[1]);
$countcategories++;
$row_printed++;
$countexit = $count++;
$nextcolumn = $categories_row[1];
}
$countexit++;
$countexplode++;
}
if($categories_row[1] == $nextcolumn)
{
}
else
{
printf("<td><input type=\"checkbox\" name=\"category%s\" value=\"%s\" unchecked>%s</td>", $countcategories, $categories_row[1], $categories_row[1]);
$countcategories++;
$row_printed++;
}
}
print("</table>
<br><br>");
printf("<input type=\"hidden\" name=\"countcategories\" value=\"%s\">", $countcategories);
print("<input type=\"submit\" name=\"editCustomer\" value=\"Edit\"></form>
</td></tr>");
}
}
else
{
print("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\">");
print("<tr><td colspan=\"4\" bgcolor=\"#00FF00\" valign=\"center\" align=\"center\"><h3>Edit Customer</h3></td></tr>");
printf("<form action = \"$PHP_SELF\" method=\"post\">");
print("<tr><td>Type Phone Number to Edit Customer Account</td></tr>
<tr><td><input type=\"text\" name=\"custPhone\"></td><td><input type=\"submit\" name=\"getCustomer\" value=\"Edit\"></td></tr>");
print("</form></table>");
}
}
}
?>
Thanks for any help. I'm positive it's not the code. Just wondering if something in my php.ini file is wrong that would not allow for buttons.
What is weird is that of the thousand page local intranet. There are only like one hundred pages where buttons don't work. The rest do. This is all wearing me out 🙁