ad

Friday, April 26, 2024

registration form in php

  

  PHP Registration form 

registration form in php


Registration Form

(USE TO HTML LANGUAGE)

Example ::-




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="
width=device-width, initial-scale=1.0">
    <title>Document</title>
  </head>
<body class="">
   
        <form action="index.php" method="post">
            <h1>Register Here</h1>
      <label>Name</label>
    <input type="text" name="unm" required><br>

       <label>Mobile No</label> <input
type="text" name="umob" required><br>

            <label>Email Address</label>
  <input type="email" name="uem" required><br>

            <label>Password</label>
 <input type="password" name="upwd"required><br>


           <select class="form-control mt-2"
name="uque" required>
                <option disabled selected>
--select sequrity Quetion--</option><br>
               
                <option class=
"What is your hobby?">What Is Your Hobby ?
</option>
            <option class="What is your
favourite color?">What is your
Favourite color?</option>
        <option class="What is your School
name?">What is your School name?</option>
        </select><br>

       
        <label>Answer</label>
        <input type="text" name="uans"
class="form-control " required> <br>
     

       

        <input type="submit" value="Register"
        name="b1">
       
        <a href="login.php" >
            Already Have an Account?</a>
   
    </form>
    </div>
   
</body>
</html>

Registration Form

Output

registration form (use html) output

Registration Form 

Example ::-

(Use to Bootstrap language )


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet"
href="css/bootstrap.css">
</head>
<body class="">
    <div class="col-md-4 bg-white shadow-lg
mx-auto mt-4 p-3">
        <form action="index.php" method="post">
            <h1 class="text-primary">Register
Here</h1>
            <label>Name</label>
            <input type="text" name="unm"
class="form-control" required>

            <label>Mobile No</label>
            <input type="text" name="umob"
class="form-control" required>

            <label>Email Address</label>
            <input type="email" name="uem"
class="form-control" required>

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


           <select class="form-control mt-2"
name="uque" required>
                <option disabled selected>
--select sequrity Quetion--</option>
               
                <option class="
What is your hobby?">What Is Your Hobby ?
</option>
            <option class="What is your
favourite color?">What is your Favourite color?
</option>
        <option class="What is your School
name?">What is your School name?</option>
        </select>

       
        <label>Answer</label>
        <input type="text" name="uans"
class="form-control " required>
     

        <div class="text-center mt-2">

        <input type="submit" value="Register"
        class="btn btn-primary" name="b1">
       
        <a href="login.php" class="btn
btn-danger">
            Already Have an Account?</a>
    </div>
    </form>
    </div>
   
</body>
</html>


Registration Form

(Use to Bootstrap language )

Output::-

Registration form (use to bootstrap) output


Registration Form 

(Use  PHP language)

Example :-


<?php
include 'connection.php';

    if(isset($_POST['b1']))
    {
       $name = $_POST['unm'];
       $mob = $_POST['umob'];
       $email = $_POST['uem'];
       $pass = $_POST['upwd'];
       $que = $_POST['uque'];
       $ans= $_POST['uans'];

       $qS="SELECT * FROM userdetails
WHERE uem = '$email'";
      // echo $qS;
      $rs = mysqli_query($cn,$qS);
      $count = mysqli_num_rows($rs);
      //echo $count;
        if($count == 1)
        {
            echo "<script>
            alert('Username Already Exist');
            </script>";
        }

        else
        {
            $qI="INSERT INTO userdetails
(unm,uem,upwd,umob,uque,uans)
            VALUES('$name','$email','$pass'
,$mob,'$que','$ans')";
          //  echo $qI;

          if(mysqli_query($cn,$qI))
          {
            echo "<script>
            alert('Register Successfully');
            window.location.href='login.php';
            </script>";

          }

          else
          {
            echo "<script>
            alert('Failed To register');
            </script>";
          }
        }
    }

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content=
"width=device-width, initial-scale=1.0">
    <title>User Registration</title>
    <link rel="stylesheet" href="
css/bootstrap.css">
</head>
<body class="">

        <h1 class=" text-center mt-3">
            <?php
        $qC ="SELECT count(uid) as x
FROM userdetails";
        $rsC=mysqli_query($cn,$qC);
        $dataC= mysqli_fetch_assoc($rsC);
       
            ?>
            Total Register User - <?php
echo $dataC['x']?>
        </h1>
   
        <div class="col-md-4 bg-white
shadow-lg mx-auto mt-5
        p-3">
           
          <h1 class="text-center text-primary">
                Register Here
            </h1>

        <form action="index.php" method="post">
            <label>Name</label>
            <input type="text" name="unm"
class="form-control mb-1"
            required>

            <label>Mobile No</label>
            <input type="text" name="umob"
class="form-control mb-1"
            required>

            <label>Email Address</label>
            <input type="email" name="uem"
class="form-control mb-1"
            required>

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

            <select class="form-control mb-1"
name="uque" required>
                <option disabled selected>
                     --Select Sequrity
Quetion --
                </option>

           <option value="What is your Hobby">
What is your Hobby?</option>
        <option value="What is your Favourite
color">What is your
Favourite color?</option>
                <option value="What is your
School Name">What is your School Name?
</option>
            </select>

            <label>Answer</label>
            <input type="text" name="uans"
class="form-control mb-1"
            required>

            <div class="text-center">
                <input type="submit"
value="Register"
            name="b1" class="btn btn-primary">

                <a href="login.php" class="
btn btn-danger">Already Have an Account ?
</a>
            </div>
            </form>
        </div>
</body>
</html>

Registration Form 

Output ::- 

(output store in the database)

             1] you can create the database 
            2] php code to call the database name 
               for example ::- wallet is database name. 

<?php

$cn = mysqli_connect("localhost","root","",
"wallet");
?>

registration form php /output

registration form php use/output


MYSQL  OUTPUT 

registration form php use mysql /output


Related Post :-

html radio button

how to create login forms

php program to check whether a number is positive or negative




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




Related Post :-

php program to print hollow triangle star pattern

php program to print alphabet pattern F

inline css in html

Saturday, April 20, 2024

php echo Function

 

PHP echo Function 

php Echo statement

php Echo statement

php Echo statement used to print the string ,multi-line strings, escaping characters, variable, array, etc. 

   Q. what is echo in php

 1] php echo is a statement is used to display the                    output.
2] php echo statement used with out parentheses echo(), and echo.
3] php echo does not return any value.
4] php echo statement multiple  by a comma(,).
5] php echo statement faster than the print .
6] php echo it returns no value or returns void.
7] php echo it display the outputs of one more strings            separated by commas.
8] echo statement is faster then print.


PHP echo 

Example ::-

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>echo php</title>

</head>
<body>
    <?php
   
        echo "hello  php echo statement";
    ?>
</body>
</html>


PHP echo 

 OUTPUT :-

php echo /output



2.Q PHP echo Multiline code 
       Example ::-

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>echo php</title>

</head>
<body>
    <?php
    //multiline code in php
        echo"hello  HI php echo statement
        This is multiline text
         php echo
              ";
    ?>
</body>
</html>

PHP echo -print Multiline String

Output   ::-

php echo /output


Related Post :-

php program print square number pattern

how to create a order form

php program to print hourglass star pattern

Tuesday, April 16, 2024

php Comments

 

Comments in PHP



php Comments


  1]Comments in PHP code are lines that are not executed as part of the program.

  2] Its sole purpose is to read the tracker's code. 

  3]all experienced returning to work after a year or two and wondering what to do next.

  4] Comments can remind you what you were thinking when you wrote the number
     Leave
 spaces between numbers

One-line comments

One-line comments start with / /.


Comments in PHP

Example :-


<!doctype html>
<html>
    <head>
        <title>html code and php code</title>
    </head>
<body>
    <h1>MY FIRST PROGRAM IN PHP </h1>
    <?php
    //echo "Hello friends
    // How are your
   
    //fine "
         ?>
</body>
</html>



Comments in PHP

Output :-

MY FIRST PROGRAM IN PHP

Related Post :-

registration form in php

php program using sum of digits

php program to print alphabet pattern Y

Monday, April 15, 2024

PHP Syntax


PHP Syntax

PHP Syntax


PHP Syntax:-

 1]  PHP is a server-side coding language widely used for web development. 

 2] PHP code is often embedded in HTML

 3] PHP files usually have save the ".php" extension.

 4] PHP file contains the HTML tags   some PHP code.

 5] PHP script that uses the built-in PHP function "echo" to display text

PHP's syntax is similar to the C language. PHP is a server-side coding language. PHP code is stored as a text file with the ".php" extension. A ".php" file is essentially a web page with HTML text interspersed between one or more blocks of PHP code. 

However, it must be opened in a browser with HTTP protocol URLs. In other words, if you double-click on the PHP file icon, it will open locally using the file protocol. For example, if you open the "index.php" file in the root folder of the Apache server, only the text of the PHP code will be displayed. However, if you start the Apache server and

 open the URL http://localhost/index.php, the Apache home page will be displayed. Therefore, a PHP parser needs to distinguish between PHP code and other content. When the ".php" file is opened on the website, the HTML engine performs the HTML/CSS/JavaScript part and runs on HTML blocks when it encounters the words contained in the PHP tags. The PHP parser process blocks the response and passes it back to the browser.


Syntax :-

<?php

//php code here


?>

PHP Syntax:-

Example :-

<!doctype html>
<html>
    <head>
        <title>html code and php code</title>
    </head>
<body>
    <h1>MY FIRST PROGRAM IN PHP </h1>
    <?php
    echo "Hello friends
     How are your
        fine "
         ?>
</body>
</html>


PHP Syntax 

Output :-

php syntax/output




Related Post :-

external css in html

html table program

website information