Sunday, April 21, 2024

php form Handling

 

PHP Form Handling

PHP form handling


PHP  form 
       

  • php program use to post method in php


   1] post is used to send data to server to create/update a resource.
   2] The data send to the server with POST is  stored in the request body of the HTTP request

  •  what is action in php

 1] A PHP form action attribute specifies the location to transfer the submitted user information.
  2]  You can configure this device to transfer data to a website or file.
  3] PHP get and php post are global methods 

  •      What is method in php

  1] Methods are used effectively in the class/ object context.
  2] When you create a function outside a class/object , you can call it a function.

 NOTE :-
      only use the HTML TAG

      Example ::-

<!DOCTYPE html>
<html
<head>
   
    <title>Document</title>
   
</head>
<body>
   
 <form action="login.php"method="post">
    <h1> Login Here</h1>
    <label>Email Address</label>
    <input type="email" name="uem" class="form-control" required><br>

    <label>Password</label>
    <input type="password" name="upwd" class="form-control" required>


        <input type="submit" value="Login" name="b1">
   
</p>
 
</form>

</body>
</html>

PHP form 

Output ::-


php form output

PHP FORM  


NOTE 

      USE to bootstrap  in PHP FORM 


  WHAT is the bootstrap 

  1]  bootstrap is free.
   2] open source front-end use.
   3] bootstrap is framework for the creation and  responsive websites.
   4]  And create responsive webpage

 
Note :- 
  • First bootstrap file download free
  •  go to the Bootstrap website  and to the download to the file (css in bootstrap include )
  • then this file link to to your login.php (program file name ) 
  • go to the code than <head> tag inclue to the fille
  • code =  this is code
       <head>
        <title>Document</title>
       
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/
    dist/css/bootstrap.min.css">


    </head>
 

EXAMPLE 

  PHP FORM (USE TO BOOTSTRAP)

<!DOCTYPE html>
<html lang="en">
<head>
   
    <title>Document</title>
   
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/

dist/css/bootstrap.min.css"
>

</head>
<body class="bg-primary">
    <div class="col-md-4 mx-auto bg-white shadow-lg mt-5 p-2">
 <form action="login.php"method="post">
    <h1 class="text-primary text-center"> Login Here</h1>
    <label>Email Address</label>
    <input type="email" name="uem" class="form-control" required><br>

    <label>Password</label>
    <input type="password" name="upwd" class="form-control" required>

    <div class="text-center mt-3 p-4">
        <input type="submit" value="Login" name="b1" class="btn btn-primary">
   
</p>
    </div>
  </form>
 </div>
   
</body>
</html>

Output 

  PHP FORM (USE TO BOOTSTRAP)

PHP FORM (USE TO BOOTSTRAP)/output






Read More

Registration form in php

PHP introduction

PHP data type

PHP Operators

PHP if statements

PHP switch statement




No comments:

Post a Comment