J
J
JackShcherbakov2018-04-05 21:25:18
PHP
JackShcherbakov, 2018-04-05 21:25:18

Why do script DOM nodes disappear from PHP output?

Hello colleagues! I recently encountered the following problem:
Why are there no script elements in the output of the code below? Where did they go and why? What am I doing wrong? Here is the code itself:

<!DOCTYPE html>
<html>

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>WebSiteBuilder v.0.0.1</title>
<link href="css/header.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/registration_form.css" rel="stylesheet">
</head>

<body>
<?php 
  include("incs/html/header.html");
  include("incs/php/form_validation.php");
?>
<main>
<?php 
if($_SERVER["REQUEST_METHOD"] == "POST"){
  $login = $_POST["login"];
  $password = $_POST["password"];
  $password_2 = $_POST["password_2"];
}
else{
?>
  <form method="POST" action="<?php echo $_SERVER['PHP_SELF']?>">
    <fieldset>
      <h1>Регистрация:</h1>
      <label>Введите логин:
        <input type="text" placeholder="логин" name="login">
      </label>
      <label>Введите пароль:
        <input type="password" placeholder="пароль" name="password">
      </label>
      <label>Введите пароль еще раз:
        <input type="password" placeholder="пароль еще раз" name="password_2">
      </label>
      <label>Введите адрес электронной почты:
        <input type="email" placeholder="адрес электронной почты" name="email">
      </label>
      <input type="submit" value="Подтвердить">
    </fieldset>
  </form>
<?php }?>
</main>
</body>
<script>
alert();
//var form = document.querySelector("form");
//	console.log(form);
</script>
</html>

I would like to thank everyone in advance who will help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-04-05
@JackShcherbakov

.....
</main>
<script>
alert();
//var form = document.querySelector("form");
//	console.log(form);
</script>
</body>
</html>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question