1

I'm sorry, i'm a newbie in php.

And i have a lot of problems when i develop. So this is another problem i met.

form.php:

<form  method="post" action="process.php">
			<h1>BESOIN </h1>
			<br><br>
			<label>Sujet:</label><input type="text" name="sujet" />&nbsp;&nbsp;
			<label>Date: </label><input type="text" name="bdate" class="datepicker" id="datepicker1">&nbsp;&nbsp;
			<label>Nature:</label>
				<input type="radio" name="nature" id="nature" value="exprime" >Exprime</input>
				<input type="radio" name="nature" id="nature" value="non"/>Non Exprime<br><br>
			<h4>Action:</h4>
			<br>
				<label>Date de l'action: </label>
					<input type="text" name="adate" class="datepicker" id="datepicker2">
				<label>Date de l'alerte: </label>
					<input type="text" name="aldate" class="datepicker" id="datepicker3"><br><br>	
				<label>Etat: </label>
					<!-- must specify the combo box name <select name="etat" >-->
					<select name="etat">
						<option  value="ready">Ready</option>
						<option  value="transacting">Transacting</option>
						<option  value="finished"/>Finished</option>
					</select><br><br>
				<label>Detail: </label><br>
					<textarea rows="5" cols="40" name="adetail"></textarea>
				<br><br>
			<h4>Qualification: </h4>
			<br>
				<label>Date:  </label>
					<input type="text" name="qdate" class="datepicker" id="datepicker4"><br><br>
				<label>Detail: </label><br>
					<textarea rows="5" cols="40" name="qdetail"></textarea>
				<br><br>
			<h4>Proposition: </h4>
			<br>
				<label>Date: </label>
					<input type="text" name="pdate" class="datepicker" id="datepicker5" /><br><br>
				<label>Detail: </label><br>
					<textarea rows="5" cols="40" name="pdetail"></textarea>  
				<br><br>
			<label>Nom du decideur: </label>
				<input type="text"  name="decideur" />
			<br><br>
			<input type="submit" name="submit" value="submit"/>

process.php

<?php 
			$conne = mysql_connect($server, $user, $password) or die(mysql_error());
			mysql_select_db($db);
			/* insert values into table besoin */
			$query = "INSERT INTO besoin
					(sujet, bdate, nature, adate, aldate, etat, adetail, qdate, qdetail, pdate, pdetail, decideur)
					VALUES('".$_POST['sujet']."','".$_POST['bdate']."','".$_POST['nature']."','".$_POST['adate']."','".$_POST['aldate']."','".$_POST['etat']."',
					'".$_POST['adetail']."','".$_POST['qdate']."','".$_POST['qdetail']."','".$_POST['pdate']."','".$_POST['pdetail']."','".$_POST['decideur']."')";
			$result = mysql_query($query) or die("Query failed: ".mysql_error());
				if($result){
					echo "<p>Input data succeed!</p>";
				} else{
					echo "<p>Input data failed!</p>";
				}

Everytime, i sumbit the form.
There is how the result displayed:

bdate
0000-00-00

Does there anyone can help me???

3
Contributors
3
Replies
13
Views
7 Years
Discussion Span
Last Post by Hubermanb
0

Do i need to convert the text generated by datepicker to date format???

Thanks for your reponse.

0
function changueFormatDate($cdate){
    list($day,$month,$year)=explode("/",$cdate);
    return $year."-".$month."-".$day;
}  
/* How use */

$insertdate = changueFormatDate($postdate);

Greetings, Gabriel (url snipped)

Edited by Ezzaral: Added code tags. Please use them to format all code that you post.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.