Jump to content

[SOLVED] dates not being added...


jesushax

Recommended Posts

hi below is my add vacancy form

 

heres the debug:

 

INSERT INTO tblVac (VacCat,VacTitle,VacRef,VacTop,VacHrs,VacWage,VacLocation,VacDetails,VacDateAdded,VacArchive) VALUES ('Administration / Clerical', 'test', 'test', '0', 'test', 'test', 'test', 'test

', '2008-22-08','0')

 

yet checking the mysql database i get this

 

(from phpmyadmin)

VacID  VacCat  VacTitle  VacRef  VacHrs  VacLocation  VacWage  VacDetails  VacTop  VacDateAdded  VacDateModified  VacArchive 

397 Administration / Clerical test test test test test test<br /> 0 0000-00-00 NULL 0

 

field type is date, anyone know why?

 

Thanks

 

<?php
switch (@$_GET["action"]) {

case "add";
include($_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php');
session_start();
include($_SERVER['DOCUMENT_ROOT'] . '/includes/access.inc');

$VacCat = $_POST["txtCat"];
$VacTitle = mysql_escape_string($_POST["txtTitle"]);
$VacRef = mysql_escape_string($_POST["txtRef"]);
if (($_POST["chkTop"]) == "1") {
$VacTop = "1";
} else {
$VacTop = "0";
}
$VacHrs = mysql_escape_string($_POST["txtHrs"]);
$VacWage = mysql_escape_string($_POST["txtWage"]);
$VacLocation = mysql_escape_string($_POST["txtLocation"]);
$VacDetails = mysql_escape_string($_POST["txtDetails"]);
$VacAdded = date("Y-d-m");

mysql_query("INSERT INTO tblVac (VacCat,VacTitle,VacRef,VacTop,VacHrs,VacWage,VacLocation,VacDetails,VacDateAdded,VacArchive) 
VALUES ('$VacCat', '$VacTitle', '$VacRef', '$VacTop', '$VacHrs', '$VacWage', '$VacLocation', '$VacDetails', '$VacAdded','0')") or die (mysql_error()); 

header("Location: /admin/vacancies/edit_vac_list.php?CAT=$VacCat");
break;
default:
session_start();
include($_SERVER['DOCUMENT_ROOT'] . '/includes/header.php');
include($_SERVER['DOCUMENT_ROOT'] . '/includes/access.inc');
echo '<div id="subheader">
	  <div class="padding">
	  <table width="100%" border="0">
  <tr>
    <td><h2 class="titles">Vacancies</h2>
Please feel free to browse and if you have any questions please use our contact form.</td>    <td style="text-align:right;"><img src="/images/layout/puddle.png" alt="logo splash" /></td>
  </tr>
</table>
			</div>
	</div>

	<div id="main">
		<div class="right_side">'."\n";
?>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
new nicEditor({xhtml:true}).panelInstance('txtDetails');		
});
</script>
<h3 class="titles">Add Vacancy</h3>
<form id="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?action=add">
<table width="100%">
<tr> 
<td>Category: <br /></td>
<td> 
<select name="txtCat" >
<option>Administration / Clerical</option>
<option>Care / Health</option>
<option>Catering</option>
<option>Construction</option>
<option>Hospitality</option>
<option>Professional / Management</option>
<option>Retail</option>
<option>Security / Ancillary</option>
<option>Voluntary</option>
</select></td>
</tr>
<tr> 
<td>Title: <br /></td>
<td> 
<input type="text" size="50" name="txtTitle" /></td>
</tr>
<tr>
  <td>Ref No:</td>
  <td><input type="text" size="20" name="txtRef" /></td>
</tr>
<tr>
  <td>Top:</td>
  <td><input name="chkTop" type="checkbox" value="1" class="noborder" /></td>
</tr>
<tr>
  <td>Hours:</td>
  <td><input type="text" size="20" name="txtHrs" /></td>
</tr>
<tr>
  <td>Wage:</td>
  <td><input type="text" size="20" name="txtWage" /></td>
</tr>
<tr>
  <td>Location:</td>
  <td><input type="text" size="40" name="txtLocation" /></td>
</tr>
<tr> 
<td colspan="2" class="top"> Details: </td>
</tr>
<tr>
<td colspan="2"><textarea name="txtDetails" style="width:550px; height:175px;"></textarea></td>
</tr>
<tr> 
<td class="center" colspan="2"> 
<input type="submit" name="Submit" value="Submit" />
<input type="reset" name="reset" value="reset" /></td>
</tr>
</table>
</form> 
<?php
include($_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php');
break;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/120854-solved-dates-not-being-added/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.