0

This is the html code

<HTML>
<head>STUDENT LOGIN</head>
<style>
.error { color: #FF0000; }
</style>
<body>
<p><span class ="error">* required field.</span></p>
<?php
$passwordErr="";
$password="";
$classError="";
$Studentclass=0;
$nameErr="";
$Studentname="";
if($_SERVER["REQUEST_METHOD"]=="POST")
{
   $Studentname=$_POST['NAME'];
if(empty($_POST['NAME']))
{
   $nameErr="Name cannot be empty";
}
elseif (!preg_match("/^[a-zA-Z]*$/",$Studentname))
{
   $nameErr="Name can contain only letters and whitespaces";
}
$Studentclass=0;
$Studentclass=(int)($_POST['CLASS']);
if(empty($Studentclass))
{
   $classError = "Class cannot be empty";
}
$password="";
$password=$_POST['PASSWORD'];
if(empty($password))
{
     $passwordErr="Password cannot be empty";
}
}
?>
<form method="POST" action=<?php echo ($_SERVER["PHP_SELF"]);?>>
NAME: <input type="text" name="NAME" ;?>
<span class="error">* <?php echo $nameErr;?></span><br>
CLASS:<input type="text" name="CLASS" ?>
<span class="error">* <?php echo  $classError ;?> </span><br>
PASSWORD:<input type="password" name="PASSWORD" ?>
<span class="error">* <?php echo  $passwordErr ;?> </span><br>
<input type="submit">
</form>
</body>
</HTML>

Now i want the form to do two things. 1.Export data to php file,which is done already by me. 2.The submit button should redirect to another php file which will be performing some work.

Another question: I have a class in lets say php1.php Now can i access the variables of the class in php1.php from a different php file?

0 Answers0