Untitled

mail@pastecode.io avatar
unknown
plain_text
19 days ago
1.2 kB
0
Indexable
Never
<html>
    <head>
        <title>server connect</title>
    </head>
    <body>
        <form action="insert.php" method="GET">
            <p>Enter Name:</p>
            <input type="text" placeholder="Your Name" id="name" name="abc">
        
            <p>Enter Address:</p>
            <input type="text" name="xyz" placeholder="Your Address">
        
            <p>Enter Contact</p>
            <input type="text" name="ccc" placeholder="No Country Code Needed">
            <br>
        
            <input type="submit" name="submit" value="submit">
            
        </form>
    </body>
</html>

<?php
    $connect=mysqli_connect("localhost","root","","sectiona","3307");
?>

<?php
    if(isset($_GET['submit'])){
        $a=$_GET['abc'];
        $b=$_GET['xyz'];
        $c=$_GET['ccc'];

        include 'connect.php';

        $query="Insert into newtable(name, address, contact) VALUES('$a','$b','$c')";

        $run=mysqli_query($connect,$query);

        if ($run)
            echo "Data Inserted";
        else
            echo "Data Not Inserted";
    }

    else{
        echo "illegal access";
        header ('location:newForm.html');
    }
?>
Leave a Comment