emphasized text How can I use validation in this code?enter image description hereenter image description here
CodePudding user response:
You can use 'required' attribute for form validation or either use jquery validation. You can use 'required' attribute like,
CodePudding user response:
Is this WordPress code? This is so wrong.
<html>
<title> Welcome page </title>
<body>
<?php echo "<h2>Your Input:</h2>"; ?>
Your Name:
<?php echo $_POST["name"]; ?>
<br><br> Your email address:
<?php echo $_POST["email"]; ?>
<br><br> Your website:
<?php echo $_POST["website"]; ?>
<br><br> Comment:
<?php echo $_POST["comment"]; ?>
<br><br> Gender:
<?php echo $_POST["gender"]; ?>
<br><br>
<button onclick="history.back()">Submit another response</button>
</body> </html>
This is the way it should be done. Do not switch back and forth between PHP and HTML mode.
$name = $_POST["name"];
$gender = $_POST["gender"];
$comment = $_POST["comment"];
$website = $_POST["website"];
echo <<<EOT
<html>
<title> Welcome page </title>
<body>
<h2>Your Input:</h2>
Your Name: $name
<br><br> Your email address: $email
<br><br> Your website: $website
<br><br> Comment: $comment
<br><br> Gender: $gender
<br><br>
<button onclick="history.back()">Submit another response</button>
</body> </html>
EOT;