I want put php date variable in html options value tag
this is my code:
<?php
$servername = "localhost";
$username = "root";
$password = "123456789";
$dbname = "db";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if(isset($_POST['submit'])){
$update = "UPDATE date SET date_end = '$choseMonth'";
if ($conn->query($update) === TRUE) {}
}
?>
<form action="update.php>" method="POST">
Use month <select name="choseMonth">
<option value="<?php $today_date = date('Y/m/d')?>">1 month + </option>
</select>
<input type="submit" name="submit" value="Update">
</form>
This code not work I don't know why .. I need put php variable in options value and I do that .. and when I look in MySql I see only 0000-00-00 I don't see date.
Please if any one can help me with this.
Thx
WHEREclause; unless that's what you want to do but I doubt that. check for errors on the query.$choseMonththat defined? question's unclear in many ways and where$today_dateis used after and not use a POST array for the<select>.<select name="date"><option value="<?php $todaydate = date('Y/m/d');>">1 Month</option>This is ok or not ?