i dont underdstand whats wrong with this mainly cause it worked yesterday and now its decided not to work, i changed all that i could think of back to see what caused the issue but nothing, maybe there is a small logic error somewhere and im just not seeing it, idk what it is but im stumped and i just need a second pair of eyes to help me out here. Thanks a bunch
<?php
/*
Instructions
The files for uploading must be in the same folder, this might be different for over the network uploading but is like this for now
There must be 11 databases all with the same parameters and fields with only their names different, names must match the table fields for each query statement
10 for the submission forms and 1 extra for the user number data thats submited
the 1 extra must be named usernumdata
*/
$con = mysqli_connect("localhost", "root", "", "numbers") or die(mysqli_error($con));
$k = NULL;
if(isset($_GET['submit']))
{
$k = $_GET['k'];
}
?>
<html>
<head>
<style>
nav {
width: 100%;
float: left;
margin: 0 0 1em 0;
padding: 0;
background-color: #f2f2f2;
border-bottom: 1px solid #ccc; }
ul {
list-style: none;
width: 800px;
margin: 0 auto;
padding: 0; }
li {
float: left; }
li a {
display: block;
padding: 8px 15px;
text-decoration: none;
font-weight: bold;
color: #069;
border-right: 1px solid #ccc; }
li:first-child a {
border-left: 1px solid #ccc; }
li a:hover {
color: #c00;
background-color: #fff; }
</style>
<!-- script that will only allow numbers to be entered into a text box, also limits them to 10 numbers-->
<script type="application/javascript">
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="nav">
<div id="menu">
<ul>
<li class="menuitem"><a href="/">Home</a></li>
<li class="menuitem"><a href="/search/">Search</a></li>
<li class="menuitem"><a href="/Multi_Delete/">Report Management</a></li>
<li class="menuitem"><a href="/table/">Reports</a></li>
<li class="menuitem"><a href="/upload/">Gov. File Upload</a></li>
<li class="menuitem"><a href="/admin/">Administration</a></li>
</ul>
<br>
</div>
</div>
<center>
<h2><font size="7">Personal Searchables</font></h2>
<br><br>
<h2><font size="4">Example: 1112223333</font></h2>
</center>
<form method="get" action="index.php" >
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="text" name="k" value="" onkeypress="return isNumberKey(event)" maxlength="10" id = "text"/>
<input type="submit" name="submit" id="search" value="Search" />
</td>
</tr>
</table>
</body>
<body>
<!--<div style="position:absolute; bottom:100; padding:10px">-->
<?php
$min_length = 10;
if(strlen($k) == $min_length)
{
//filter out non numeric and special characters
$k = mysqli_real_escape_string($con, $_GET['$k']);
echo "<table border='0' width='300' align='center' cellpadding='0' cellspacing='0'>";
echo "<tr align='center' bgcolor='#002C40' style='color:#FFF'> <td height='35px' width='150px'><font size='6'>Phone Number</font></td> </tr>";
echo "<div style='text-align: center'> <font size='6'>".$k."</font> <div>";
$query = "SELECT * FROM numdata WHERE numb='".$k."'";
$query2 = "SELECT * FROM numdata2 WHERE numb='".$k."'";
$query3 = "SELECT * FROM numdata3 WHERE numb='".$k."'";
$query4 = "SELECT * FROM numdata4 WHERE numb='".$k."'";
$query5 = "SELECT * FROM numdata5 WHERE numb='".$k."'";
$query6 = "SELECT * FROM numdata6 WHERE numb='".$k."'";
$query7 = "SELECT * FROM numdata7 WHERE numb='".$k."'";
$query8 = "SELECT * FROM numdata8 WHERE numb='".$k."'";
$query9 = "SELECT * FROM numdata9 WHERE numb='".$k."'";
$query10 = "SELECT * FROM numdata10 WHERE numb='".$k."'";
$query11 = "SELECT * FROM usernumdata WHERE numb='".$k."'";
$raw_results = mysqli_query($con, $query);
$raw_results2 = mysqli_query($con, $query2);
$raw_results3 = mysqli_query($con, $query3);
$raw_results4 = mysqli_query($con, $query4);
$raw_results5 = mysqli_query($con, $query5);
$raw_results6 = mysqli_query($con, $query6);
$raw_results7 = mysqli_query($con, $query7);
$raw_results8 = mysqli_query($con, $query8);
$raw_results9 = mysqli_query($con, $query9);
$raw_results10 = mysqli_query($con, $query10);
$raw_results11 = mysqli_query($con, $query11);
$error = "<tr align='center' bgcolor='#FF0000'> <td height='25px'><font size='5'>Registered Number: CANNOT CALL!!</font></td> </tr>" ;
if(mysqli_num_rows($raw_results) > 0)
{
if($results = mysqli_fetch_array($raw_results))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results2) > 0)
{
if($results = mysqli_fetch_array($raw_results2))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results3) > 0)
{
if($results = mysqli_fetch_array($raw_results3))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results4) > 0)
{
if($results = mysqli_fetch_array($raw_results4))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results5) > 0)
{
if($results = mysqli_fetch_array($raw_results5))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results6) > 0)
{
if($results = mysqli_fetch_array($raw_results6))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results7) > 0)
{
if($results = mysqli_fetch_array($raw_results7))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results8) > 0)
{
if($results = mysqli_fetch_array($raw_results8))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results9) > 0)
{
if($results = mysqli_fetch_array($raw_results9))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results10) > 0)
{
if($results = mysqli_fetch_array($raw_results10))
{
echo "$error" ;
}
}
elseif(mysqli_num_rows($raw_results11) > 0)
{
if($results = mysqli_fetch_array($raw_results11))
{
echo "$error" ;
}
}
else{
echo "<tr align='center' bgcolor='#00FF00'> <td colspan='2' height='25px'><font size='5'>Unregistered Number: CALLING PERMITTED</font></td> <tr>";
echo "</table>";
}
}
else{
$length = "Remember Phone Number Must be ".$min_length. " Digits Long and Contain all Numeric Characters";
echo "<div style='text-align: center'><font size='5' color='blue'>".$length."</font> <div>";
}
?>
<form method="post" action="index.php">
<table style = "margin-bottom: 10px;" width="400" border="0" cellspacing="1" cellpadding="2">
<div style = "margin-bottom: 100px" >
<tr width="200">
<font size="6">
<center>
Add a New Number to the Do Not Call List
</center>
</tr>
</font>
</div>
<tr>
<td width="100">Employee Name:</td>
<td>
<input name="empname" type="text" id="empname">
</td>
</tr>
<tr>
<td style="width:100%;" width="200">Customer First Name:</td>
<td>
<input name="firstname" type="text" id="firstname">
</td>
</tr>
<tr>
<td style="width:100%;" width="200">Customer Last Name:</td>
<td>
<input name="lastname" type="text" id="lastname">
</td>
</tr>
<tr>
<td style="width:100%;" width="200">Customer Email:</td>
<td>
<input name="email" type="text" id="email">
</td>
</tr>
<tr>
<td width="200">Phone Number:</td>
<td>
<input type="text" name="newnum" value="" onkeypress="return isNumberKey(event)" maxlength="10" id = "newnum"/>
</td>
</tr>
<tr>
<td>
<input name="add" type="submit" id="add" value="Submit">
</td>
</tr>
</table>
</form>
<!--</div>-->
</body>
</body>
</html>
<?php
//submission code, inserting data into mysql database
$newnum = NULL;
$mySqlDate = date('Y-m-d');
$mySqlTime = date('g:i a');
if(isset($_GET['add']))
{
$empname = $_GET['empname'];
$newnum = $_GET['newnum'];
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$email = $_GET['email'];
}
if(strlen($newnum) == $min_length)
{
//filter out non numeric and special characters
$empname = mysqli_real_escape_string($con, $_GET['empname']);
$newnum = mysqli_real_escape_string($con, $_GET['newnum']);
$firstname = mysqli_real_escape_string($con, $_GET['firstname']);
$lastname = mysqli_real_escape_string($con, $_GET['lastname']);
$email = mysqli_real_escape_string($con, $_GET['email']);
$check = mysqli_query($con, "SELECT count(*) FROM usernumdata WHERE numb = '".$newnum."'") or die();
$row = mysqli_fetch_row($check);
if ($row[0] == 0)
{
$sql="INSERT INTO usernumdata (empname, numb, firstname, lastname, email, date, time) VALUES ('".$empname."','".$newnum."','".$firstname."','".$lastname."','".$email."','".$mySqlDate."','".$mySqlTime."')";
if (!mysqli_query($con,$sql)) {
die('Error: ' . mysqli_error($con));
}
echo "<div style='text-align: center'> <font size='6' color='green'>Successfully Added New Entry</font> <div>";
}
else
{
echo "<div style='text-align: center'> <font size='6' color='red'>Number Already Exists In Do Not Call List</font> <div>";
}
}
else{
$length = "Remember Phone Number Must be ".$min_length. " Digits Long and Contain all Numeric Characters";
echo "<div style='text-align: center'><font size='5' color='blue'>".$length."</font> <div>";
}
?>