Hello everyone,
I've searched a lot of time today for a solution, but not succeed!
I want to insert value from the radio button and checkbox into mysql database.
Here is my code:
insert.php
<div id="form">
<form method="post" action="process.php">
<h1>BESOIN </h1>
<br><br>
<label>Sujet:</label><input type="text" name="sujet" />
<label>Date: </label><input type="text" name="bdate" class="datepicker" id="datepicker1">
<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>
<select>
<option name="etat" value="ready">Ready</option>
<option name="etat" value="transacting">Transacting</option>
<option name="etat" 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"/>
</form>
</div>
process.php
<div id="wcontent">
<?php
$conne = mysql_connect($server, $user, $password) or die(mysql_error());
mysql_select_db($db);
$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>";
}
*/
echo "<p><a href=\"besoinlist.php\" >Back to Besoin list</a></p>";
?>
</div>
Error:
Notice: Undefined index: bdate in process.php on line 26
Notice: Undefined index: nature in process.php on line 26
Notice: Undefined index: etat in process.php on line 26
Notice: Undefined index: adetail in process.php on line 26
Notice: Undefined index: qdate in process.php on line 26
Notice: Undefined index: qdetail in process.php on line 26
Notice: Undefined index: pdate in process.php on line 26
Notice: Undefined index: pdetail in process.php on line 26
Notice: Undefined index: decideur in process.php on line 26
Input data succeed!
Does anyone can give me the guidance. Thanks very much!!!