Date from form.
Go to solution
Solved by keja,
thanks but that doesn't explain why the same code doesn't work here but does somewhere else.
this code posts date correctly
if(isset($_POST['addsession'])){ // add username to $user $user = $_SESSION['username']; //add form data to variables $location = $_POST['location']; $date = $_POST['date']; $time = $_POST['time']; //if submitted data is empty if ($location=='' || $date=='' || $time=='') { //display alert do_alert("All fields must be filled in"); //redirect to home page redirect("../index.php"); }else { //insert data into database $sql = "INSERT INTO sessions (createdby, location, date, time) VALUES ('$user','$location', '$date', '$time')"; //if session as inserted into databe if ($conn->query($sql) === TRUE) { //display message do_alert("Session created"); redirect("../index.php"); } else { //diplay error do_alert("Error could not connect to database"); redirect("../index.php"); } }}code is OP doesn't and i can't see for the life on my why, I have a number of forms that post a date and this is the only one that isn't working. I hate PHP sometimes
it works there because its treated like a string as you have single quotes wrapped around $date.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now