Hey everyone. I have a couple of questions related to PHP. I realized I need to learn how to code in baby steps until I get the gist of it. This is how I learn best, knowing every detail so I can break it down in my head. Which is what I came to realize a lot of books and courses don't explain.....Ok so.. It's why questions. Why does this do that and why are there 3 brackets...etc.
1. $clean[“text”]=str_replace("malicious", " ", $_POST[text]);
Why are there three " above and why are they positioed in that spot?
2. <?php
if($_POST){
$password = $_POST['password'];
$user = $_POST['name'];
//you should also encrypt the password in your database, MD5 is the simplest
$password = md5($password);
//If inserted user record successfully you will get ID from the database for that user
// U use that to log in the user with that ID or whatever you need to do it. often redirect like
if($last_insertId){
//redirect
//header('Location:loggedIn.php');
//Instead of echoing, you can output the username in HTML
echo 'Registered!';
}
}
?>
Why are there two } brackets? Are those closing brackets? Like in HTML if you have <div class="header1"> <div class="header2"> You need </div></div> to make sure the code is correct and doesn't break anything?