mercredi 6 avril 2016

How to validate php if form is filled

//So i have a php validation external and a html file. I'm trying to validate if //the input boxes are filled out correctly... so far i have one but I can't get it //to run and i tried testing it out doesn't work... do i need to download //something or is my code completely wrong. I just trying to check if its empty and if it has at least 3 characters

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Cal5t</title>
</head>

<body>
<?php

$title= $_REQUEST["title"];
if ($title == "" or >3 ) {
echo "<p>5please!</p>";
?>
</body>
</html>

and my html form

 <!DOCTYPE html>
 <html>
 <head>
 <link rel="stylesheet" type="text/css" href="Cal.css">
 </head>
 <body>
 <script src="Cal.js"></script>


 <h1>Calendar</h1>
 <script>
 for ( var c = 0; c < month_names.length; c++ ) {
 document.write("<button onclick='loadCalendar(" + c + ");'>" +           month_names[c] + "</button>");
    }
    </script>
    <div id="my_calendar">My calendar</div>



 <form method="post" method= "cal5.php" >
 Title of Event:<br>
 <input type="text" name="title" /><br/>
 Date of event :<br>
 <input type="text" name="date" /><br/>
 Start Time of event :<br>
 <input type="text" name="stime" /><br/>
 End Time of event :<br>
 <input type="text" name="etime" /><br/>
 # Of participants :<br>
 <input type="text" name="part" /><br/>
 Email :<br>
 <input type="text" name="email" /><br/>
 Type of Event :<br>
 <input type="text" name="type" /><br/> 
 <input type="submit" value="Submit">
 </form>

Aucun commentaire:

Enregistrer un commentaire