captainer
04-22-2012, 08:59 PM
Hello,
I have a forum I am creating, when load it in my browser, the forum loads and displays correctly, however, I get an error statingnotice: Undefined index: Submit in C:\xampp\folder\file.php on line 19 Can someone explain what is causing the error, here is my code.
<?php
session_start();
include ('dbc.php');
//Form Error Checking.
if ($_POST['Submit'] == 'Submit')
//if (!isset($_POST['Submit']) || ($_POST['Submit'] != 'Submit'))
{
//Verify Service Order# is Eight Charecters.
if (strlen($_POST['servord_num']) < 8)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Invalid Service Order #..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Customer Reference # is 11 Charectors
if (strlen($_POST['custref_num']) < 11)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Invalid Customer Reference #..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Technicians Name
if (strlen($_POST['tech_name']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Please Enter Your First & Last Name..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Technicians Phone
if (strlen($_POST['tech_phone']) < 10)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Please Enter Your Contact Phone..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Technicians E-Mail
if (strlen($_POST['tech_email']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Incorrect email format, Please enter valid email address..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Dispatching Company
if (strlen($_POST['reportto_comp']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Enter Company Dispatched From..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Servicing Company
if (strlen($_POST['serv_comp']) < 3)
{
echo("<br><br><br><br><br><br>");
die ("Enter Name Of Company Where Equipment Is Being Serviced..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Client's Address
if (strlen($_POST['client_addr']) < 10)
{
echo("<br><br><br><br><br><br>");
die ("Address Of Company Where Equipment Is Being Serviced..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Clien's Phone
/*if (strlen($_POST['client_phone']) < 10)
{
echo("<br><br><br><br><br><br>");
die ("Enter Clients Ten or Eleven Digit Phone Number..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}*/
//Service Date
if (strlen($_POST['serv_month']) < 2 && ($_POST['serv_day']) < 2 && ($_POST['serv_year']) < 4)
{
echo("<br><br><br><br><br><br>");
die ("Incorrect Date Format, Enter Correct Date In The Proper Format \"mm/dd/yyyy\"..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Arrival Time At Clients Location.
if (strlen($_POST['arv_time']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Enter The Time You Arrived At Clients Site..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Departure Time From Clients Location.
if (strlen($_POST['dep_time']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Enter Time You Departed From Clients Site..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Milage OneWay.
if (strlen($_POST['miles_oneway']) < 1)
{
echo("<br><br><br><br><br><br>");
die ("Enter The Miles Traveled Oneway To Clients Location..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Query To Insert Date Into MySQL Database.
$insert = mysql_query("INSERT INTO invoice
(`servord_num`,`custref_num`,`tech_name`,`tech_phone`,`tech_email`,`reportto_comp`,`serv_comp`,`clie nt_addr`,`client_phone`,`serv_month`,`serv_day`,`serv_year`,`arv_time`,`dep_time`,`miles_oneway`,`pa rking`,`toll`)
VALUES
('$_POST[servord_num]','$_POST[custref_num]','$_POST[tech_name]','$_POST[tech_phone]','$_POST[tech_email]','$_POST[reportto_comp]','$_POST[serv_comp]','$_POST[client_addr]','$_POST[client_phone]','$_POST[serv_month]','$_POST[serv_day]','$_POST[serv_year]','$_POST[arv_time]','$_POST[dep_time]','$_POST[miles_oneway]','$_POST[parking]','$_POST[toll]')") or die(mysql_error());
$message =
"Thank you for registering with Fantasy Nails & Spa.\nYour login details are displayed below, please save this information in a safe place...\n\n
User Email: $_POST[tech_email] \n\n\n
You may login by clicking the link below or copying and pasting the url into your browser:\n
http://norcopathfinders.com/mergedfantasy/login.php or
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";
echo("Time Loged Successfully! Select the \"History\" link to see a list of the times inputed into the database....<br>Please check your e-mail address for a link to log into your account.");
echo("<br><br><br><br><br><br><br><br><br><br>");
?><p></p>
<p> </p>
</div>
<div id="content_bottom"></div><?php
exit;
}
?>
<link href="styles.css" rel="stylesheet" type="text/css">
<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; }
// Populate Password Fields With Random Password.
/**
* The letter l (lowercase L) and the number 1
* have been removed, as they can be mistaken
* for each other.
*/
function createRandomPassword() {
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
// Usage
$password = createRandomPassword();
//echo "Your random password is: $password";
//echo "You are not authorized to view the contents of this page. Contact your site administrator.";
?>
Forum: <tr>
<td></td>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
<td></td>
</tr>
</form>
I have a forum I am creating, when load it in my browser, the forum loads and displays correctly, however, I get an error statingnotice: Undefined index: Submit in C:\xampp\folder\file.php on line 19 Can someone explain what is causing the error, here is my code.
<?php
session_start();
include ('dbc.php');
//Form Error Checking.
if ($_POST['Submit'] == 'Submit')
//if (!isset($_POST['Submit']) || ($_POST['Submit'] != 'Submit'))
{
//Verify Service Order# is Eight Charecters.
if (strlen($_POST['servord_num']) < 8)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Invalid Service Order #..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Customer Reference # is 11 Charectors
if (strlen($_POST['custref_num']) < 11)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Invalid Customer Reference #..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Technicians Name
if (strlen($_POST['tech_name']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Please Enter Your First & Last Name..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Technicians Phone
if (strlen($_POST['tech_phone']) < 10)
{
echo("<br><br><br><br><br><br>");
die ("ERROR: Please Enter Your Contact Phone..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Verify Technicians E-Mail
if (strlen($_POST['tech_email']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Incorrect email format, Please enter valid email address..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Dispatching Company
if (strlen($_POST['reportto_comp']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Enter Company Dispatched From..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Servicing Company
if (strlen($_POST['serv_comp']) < 3)
{
echo("<br><br><br><br><br><br>");
die ("Enter Name Of Company Where Equipment Is Being Serviced..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Client's Address
if (strlen($_POST['client_addr']) < 10)
{
echo("<br><br><br><br><br><br>");
die ("Address Of Company Where Equipment Is Being Serviced..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Clien's Phone
/*if (strlen($_POST['client_phone']) < 10)
{
echo("<br><br><br><br><br><br>");
die ("Enter Clients Ten or Eleven Digit Phone Number..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}*/
//Service Date
if (strlen($_POST['serv_month']) < 2 && ($_POST['serv_day']) < 2 && ($_POST['serv_year']) < 4)
{
echo("<br><br><br><br><br><br>");
die ("Incorrect Date Format, Enter Correct Date In The Proper Format \"mm/dd/yyyy\"..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Arrival Time At Clients Location.
if (strlen($_POST['arv_time']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Enter The Time You Arrived At Clients Site..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Departure Time From Clients Location.
if (strlen($_POST['dep_time']) < 5)
{
echo("<br><br><br><br><br><br>");
die ("Enter Time You Departed From Clients Site..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Milage OneWay.
if (strlen($_POST['miles_oneway']) < 1)
{
echo("<br><br><br><br><br><br>");
die ("Enter The Miles Traveled Oneway To Clients Location..<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");?>
<p></p>
<p> </p>
</div>
<div id="content_bottom"></div>
</div>
</div><?php
}
//Query To Insert Date Into MySQL Database.
$insert = mysql_query("INSERT INTO invoice
(`servord_num`,`custref_num`,`tech_name`,`tech_phone`,`tech_email`,`reportto_comp`,`serv_comp`,`clie nt_addr`,`client_phone`,`serv_month`,`serv_day`,`serv_year`,`arv_time`,`dep_time`,`miles_oneway`,`pa rking`,`toll`)
VALUES
('$_POST[servord_num]','$_POST[custref_num]','$_POST[tech_name]','$_POST[tech_phone]','$_POST[tech_email]','$_POST[reportto_comp]','$_POST[serv_comp]','$_POST[client_addr]','$_POST[client_phone]','$_POST[serv_month]','$_POST[serv_day]','$_POST[serv_year]','$_POST[arv_time]','$_POST[dep_time]','$_POST[miles_oneway]','$_POST[parking]','$_POST[toll]')") or die(mysql_error());
$message =
"Thank you for registering with Fantasy Nails & Spa.\nYour login details are displayed below, please save this information in a safe place...\n\n
User Email: $_POST[tech_email] \n\n\n
You may login by clicking the link below or copying and pasting the url into your browser:\n
http://norcopathfinders.com/mergedfantasy/login.php or
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";
echo("Time Loged Successfully! Select the \"History\" link to see a list of the times inputed into the database....<br>Please check your e-mail address for a link to log into your account.");
echo("<br><br><br><br><br><br><br><br><br><br>");
?><p></p>
<p> </p>
</div>
<div id="content_bottom"></div><?php
exit;
}
?>
<link href="styles.css" rel="stylesheet" type="text/css">
<?php if (isset($_GET['msg'])) { echo "<div class=\"msg\"> $_GET[msg] </div>"; }
// Populate Password Fields With Random Password.
/**
* The letter l (lowercase L) and the number 1
* have been removed, as they can be mistaken
* for each other.
*/
function createRandomPassword() {
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
// Usage
$password = createRandomPassword();
//echo "Your random password is: $password";
//echo "You are not authorized to view the contents of this page. Contact your site administrator.";
?>
Forum: <tr>
<td></td>
<td colspan="3" align="center"><input type="submit" name="Submit" value="Submit"></td>
<td></td>
</tr>
</form>