Hello,
I am currently coding a site from scratch. I know i can use templates and everything else but i want the experience. The HTML I've had down for years but it seems PHP is getting a little elusive for me. I'm trying to create a registration form and when i test my site i keep getting parse errors and syntax errors... mainly regarding the use of {} and if/else. Any help would be appreciated. Most of the code is still incomplete, I have to go back and fill in some areas I've left blank for now, but i have commented using // Where the browser is kicking back my errors.
- “Any sufficiently advanced technology is indistinguishable from magic” (Arthur C. Clark, 1962)
<?php
$con = Mysqli_connect("'', '', ''");
if (Mysqli_connect_errno()) {
echo "Failed to connect to DB. Please check your connection info." . Mysqli_connect_errno;
// Only if there is an error.
}
//Declaring Variable for Registration form
$fname = "";
$lname = "";
$em = "";
$emc = "";
$pass = "";
$passc = "";
$date = "";
$error_array = "";
if (insert($_POST['register_button'])) {
// To handle the registration form
// First Name Values
$fname = strip_tags($_POST['reg_fname']);
$fname = str_replace(' ', '', $fname);
$fname = ucfirst(strtolower($fname));
// Last Name Values
$lname = strip_tags($_POST['reg_lname']);
$lname = str_replace(' ', '', $lname);
$lname = ucfirst(strtolower($lname));
// Registration Email Values
$em = strip_tags($_POST['reg_email']);
$em = str_replace(' ', '', $em);
// Confirm Registration Email Values
$emc = strip_tags($_POST['reg_emailc']);
$emc = str_replace(' ', '', $emc);
// Registrsation Password Values
$pass = strip_tags($_POST['reg_pass']);
// Registration Password Confirmation Values
$passc = strip_tags($_POST['reg_passc']);
// Registration Date Values
$date = date("m-d-Y");
// Here is where the browser keeps kicking back parse errors
if ($em == $emc) {
}
else {
echo "Email and Confirmation Email must match";
}
if (filter_var($em, FILTER_VALIDATE_EMAIL)) {
$em = filter_var($em, FILTER_VALIDATE_EMAIL)
}
else {
echo "Invlaid Format";
}
?>