Show Code:
movement-create.php
<?php include 'session.php'; ?>
<!DOCTYPE html>
<html>
<head>
<title>Alexandria</title>
<link href="style1.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<?php include 'nav.php'; ?>
<?php include 'db-connect.php'; ?>
<main>
<?php
//handle initial create page
if( $_POST['movement_name']==''){
?>
<form method="post" action="movement-create.php">
<label>Movement Name: </label>
<input type="text" name="movement_name">
<label>Description: </label>
<textarea name="movement_description"></textarea>
<input type="submit" value="Create">
</form>
<?php
}
//handle recursive form
else{
$movement_name=$_POST['movement_name'];
$movement_description=$_POST['movement_description'];
$sql='INSERT INTO t_movements (movement_name, movement_description)
VALUES ("'.$movement_name.'", "'.$movement_description.'")';
if(mysqli_query($con,$sql)){
echo 'Movement has been created';
}
else{
echo "Error creating movement: " . mysqli_error($con);
}
}
?>
<?php mysqli_close($con); //Close Connection?>
</main>
</body>
</html>