Jump to content

Notice: Undefined index: datepicker in page on line 57


Birdmansplace

Recommended Posts

Notice: Undefined index: datepicker in page on line 57.  I have added js jquery calander to a form entry.  i have everything changed so it works in page and when and made sure code works for mysql to write the date to sql.  So before i changed my code for this everything worked and would write to mysql.  Once i got the calendar to work witch i had to change field names in sql and in the php code and now it wount work.  If i change everything back it will. Only thing that has changed is adding the calendar and field name('s) in sql and php code.

 

Line 57 is :              $datepicker = mysql_real_escape_string($_POST['datepicker']);

 

the hole page code:

<div align="center">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<link type="text/css" href="calendar/css/custom-theme/jquery-ui-1.7.2.custom.css" rel="stylesheet" />	
	<script type="text/javascript" src="calendar/js/jquery-1.3.2.min.js"></script>
	<script type="text/javascript" src="calendar/js/jquery-ui-1.7.2.custom.min.js"></script>
	<script type="text/javascript">
		$(function(){

			// Datepicker
			$('#datepicker').datepicker({
				inline: true
			});

			//hover states on the static widgets
			$('#dialog_link, ul#icons li').hover(
				function() { $(this).addClass('ui-state-hover'); }, 
				function() { $(this).removeClass('ui-state-hover'); }
			);

		});
	</script>
	<style type="text/css">
		/*demo page css*/
		body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}
		.demoHeaders { margin-top: 2em; }
		#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
		#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
		ul#icons {margin: 0; padding: 0;}
		ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left;  list-style: none;}
		ul#icons span.ui-icon {float: left; margin: 0 4px;}
	</style>	
</head>









<?php
ini_set("display_errors", "10");
error_reporting(E_ALL);

if (isset($_POST['submit']))
{ 
{                       
                   //YOU NEED TO HAVE AN EXTERNAL PHP FILE WITH YOUR DATABASE CONNECTION DETAILS. LET ME KNOW IF YOU DON'T KNOW HOW             
                   include("dbinfo.php");
                   mysql_connect('localhost',$username,$password);
                   @mysql_select_db($database) or die( "Unable to establish a connection to the relevant database.");

                   
                   $stitle = mysql_real_escape_string($_POST['stitle']);
                   $datepicker = mysql_real_escape_string($_POST['datepicker']);
			   $sbody = mysql_real_escape_string($_POST['sbody']);
	           $ipaddress = getenv('REMOTE_ADDR');
                   $now_datetime = date('Y-m-d h:i:s');
	           $msg = "Your request has been entered $stitle !";

                   $query = "INSERT INTO simple_search VALUES ('','$stitle','$datepicker','$sbody','$ipaddress',NOW())";
                   mysql_query($query);

              
                                   
                   echo "<br />";
	   		   echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>";
                   echo "<a href='requestoff.php'><input name='' type='button' value='Enter another Request'/>";
                   echo "<br /><br /><br /><br />";
                   include("html/overall_footer.html");




                   
                   exit();
              }

}

?>


<br />
<li>Capitalize your First name as shown in box</li>
<li>Date must be like this: "01/01/10" with out the quotes other wise it might be missed</li>
<li>Reason: Appointment, cant open/close, etc...</li>
<li>If you made a mistake thats ok, just re-enter with the correct info.<br />
The number at the begining is a list number and email me or texted me that<br />
you made a mistake along with the list number and I will delete it.</li>
<br />


<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
Name:<input type="text" name="stitle" id="stitle" value="Name<?php if (isset($_POST['stitle'])) echo $_POST['stitle']; ?>" size="10"/>

<div div="datepicker">
Date: <input type="text" id="datepicker" value="<?php if (isset($_POST['datepicker'])) echo $_POST['datepicker']; ?>" size="12">
</div>
<br />
<br />
Reason:<input type="text" name="sbody" id="sbody" value="Cant open/close, Etc..<?php if (isset($_POST['sbody'])) echo $_POST['sbody']; ?>" size="50"/> 
<br />

<input type="submit" name="submit" id="submit" value="Submit Details">
<input type="reset" name="reset" id="reset" value="Reset Form">
</form>
</body>
<div align="center">
<?php

ini_set("display_errors", "1");
error_reporting(E_ALL);
include("dbinfo.php");

mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "SELECT `stitle`, `datepicker`, `sbody`, `sid` FROM simple_search ORDER BY datepicker";
$result = mysql_query($query);

if (!$result)
{
    //Temporary error handling
    echo "There was a problem:<br />".mysql_error();
}

while($record = mysql_fetch_assoc($result))
{
    echo "<br /><br />";
    echo "<input name='' style='font-size:14px' type='text' value='{$record['sid']} {$record['stitle']} {$record['datepicker']} {$record['sbody']} ' size='85' maxlength='10' readonly='true'/>";

}

?>
</div>

</div>

 

I have been fighting this for over a day and just cant figure out wtf is causing the error code.

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.