malleshtekumatla

php registration form with all fields with file upload or resume upload

Now we are going to create a simple user registration form with all input fields:

  • text input fields
  • password
  • radio buttons
  • checkboxes
  • select options
  • file upload

We need table to store our data . First create a database in your phpmyadmin. Then run below code to create table inthat database.

CREATE TABLE `registerform` (
  `id` int(12) NOT NULL,
  `name` varchar(200) DEFAULT NULL,
  `email` varchar(200) DEFAULT NULL,
  `password` varchar(200) DEFAULT NULL,
  `gender` varchar(200) DEFAULT NULL,
  `hobbies` varchar(200) DEFAULT NULL,
  `country` varchar(200) DEFAULT NULL,
  `resume` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

BELOW CODE CONTAINS “DB CONNECTIONS” , “SQL DATA INSERT” AND HTML “FORM CODE” IN SINGLE FORM ONLY

SAVE WITH (registerform.php)

<?php 
 $dbhost = "localhost";
 $dbuser = "root";
 $dbpass = "";
 $db = "malleshtekumatla";
 
 $conn = new mysqli($dbhost, $dbuser, $dbpass,$db);

//print_r($_POST);exit;
	if( $_POST ){
	extract( $_POST );
	$file =$_FILES['resume']['name'];
    $file_loc = $_FILES['resume']['tmp_name'];
	$folder="uploads/";
	move_uploaded_file($file_loc,$folder.$file);
	
	$hobbiesimpo = implode(",",$hobbies);
 

// Check connection
if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql="INSERT INTO registerform(name,email,password,gender,hobbies,country,resume)
VALUES('$name','$email','$password','$gender','$hobbiesimpo','$country','$file')"; if ($conn->query($sql) === TRUE) { echo "
<h1 style="text-align: center;">New record created successfully</h1>
"; } else { echo "Error: " . $sql . "<br />
" . $conn->error; } $conn->close(); } ?>

<html>
    <head>
        <title>MY HTML FORM</title>
        <style>
            td {
                color: yellow;
                font-size: 15px;
                border: 1px solid red;
            }
            input,
            textarea,
            select {
                font-size: 20px;
                padding: 10px;
                border-radius: 9px;
            }
        </style>
    </head>

    <body bgcolor="yellow">
        <form name="form" method="post" enctype="multipart/form-data">
            <table width="840" align="center" bgcolor="green" cellpadding="15" border="5px" color="red">
                <tr>
                    <td colspan="2" align="center"><h2>REGISTRAION FORM</h2></td>
                </tr>

                <tr>
                    <td>USER NAME :</td>
                    <td><input type="text" name="name" placeholder="Please Enter username" /></td>
                </tr>

                <tr>
                    <td>EMAIL :</td>
                    <td><input type="email" name="email" placeholder="Please Enter Email" /></td>
                </tr>

                <tr>
                    <td>PASSWORD :</td>
                    <td><input type="password" name="password" placeholder="Please Enter password" /></td>
                </tr>

                <tr>
                    <td>GENDER :</td>
                    <td>
                        <input type="radio" name="gender" value="male" />MALE <br />
                        <input type="radio" name="gender" value="female" />FE MALE
                    </td>
                </tr>

                <tr>
                    <td>HOBBIES :</td>
                    <td><input type="checkbox" name="hobbies[]" value="crircket" />Cricket <input type="checkbox" name="hobbies[]" value="football" />FootBall <input type="checkbox" name="hobbies[]" value="chess" />Chess</td>
                </tr>

                <tr>
                    <td>SELECT COUNTRY :</td>
                    <td>
                        <select name="country">
                            <option value="India"> India</option>
                            <option value="India"> China</option>
                            <option value="Australia"> Australia</option>
                            <option value="Newzeland"> Newzeland</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>UPLOAD YOUR RESUME :</td>
                    <td><input type="file" name="resume" /></td>
                </tr>

                <tr>
                    <td colspan="2" align="center"><input type="submit" /></td>
                </tr>
            </table>
        </form>
    </body>
</html>

NOTE: For file upload you need to create a “uploads” folder in your root folder.

How to execute file in local system ?

http://localhost/MALLESH/registerform.php

In my case iam using “xampp” the file path like below

C:\xampp\htdocs\MALLESH\ http://localhost/MALLESH/registerform.php

Above path “MALLESH” is my root folder name you can give any name

Model 2 form when we have LIVE DATABASE DETAILS

TABLE CODE FOR CREATION

CREATE TABLE `contact` (
  `id` int(12) NOT NULL,
  `name` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `lastname` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `phonenumber` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `city` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `message` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

SAVE WITH (registerform2.php)

<?php
 $dbhost = "localhost";
 $dbuser = "u657728665_balimistudios";
 $dbpass = "Balimistudios@123";
 $db = "u657728665_balimistudios";
  
 $conn = new mysqli($dbhost, $dbuser, $dbpass,$db);
 
 if( $_POST )
  {
      //print_r($_POST);exit;
  	//getting the post values
    $name=$_POST['name'];
    $lastname=$_POST['lastname'];
    $email=$_POST['email'];
    $phonenumber=$_POST['phonenumber'];
    $city=$_POST['city'];
    $message=$_POST['message'];
   
  // Query for data insertion
     $query=mysqli_query($conn, "insert into contact(name,lastname,email,phonenumber,city,message) 
     value('$name','$lastname', '$email', '$phonenumber', '$city','$message' )");
    if ($query) {
        
        
    $to = "ENTER YOUR ADMIN EMAIL WHOM YOU WANT TO SEND MAILS"; // this is your Email address
    $from = $_POST['email']; // this is the sender's Email address
    $first_name = $_POST['name'];
    $last_name = $_POST['lastname'];
    $subject = "Form submission";
    $subject2 = "Copy of your form submission";
    $message = $first_name . " " . $last_name . " wrote the following:" . "\n\n" . $_POST['message'];
    $message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];

    $headers = "From:" . $from;
    $headers2 = "From:" . $to;
    mail($to,$subject,$message,$headers);
    mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
    echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
    // You can also use header('Location: thank_you.php'); to redirect to another page.
    // You cannot use header and echo together. It's one or the other.
    }
        
    echo "<h1 style='text-align: center;'>New record created successfully</h1>";
    echo "<script type='text/javascript'> document.location ='httpsttttt://somesite.com/contact.html'; </script>";
  }
  else
    {
      echo "<script>alert('Something Went Wrong. Please try again');</script>";
    }

?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}
* {box-sizing: border-box;}

input[type=text], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}

input[type=submit] {
  background-color: #04AA6D;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

input[type=submit]:hover {
  background-color: #45a049;
}

.container {
  border-radius: 5px;
  background-color: #f2f2f2;
  padding: 20px;
}
</style>
</head>
<body>

<h3>Contact Form</h3>

<div class="container">
      <form name="form" method="post" enctype="multipart/form-data">
 
    <label for="fname">First Name</label>
    <input type="text" id="fname" name="name" placeholder="Your name..">

    <label for="lname">Last Name</label>
    <input type="text" id="lname" name="lastname" placeholder="Your last name..">

    <label for="fname">Email</label>
     <input type="email" id="lname" name="email" placeholder="Your Email.."><br>
<br>
<br>
   <label for="fname">Phone Number</label>
     <input type="text" id="lname" name="phonenumber" placeholder="Your Phonenumber..">
     <br>
     <br>
      <label for="fname">City</label>
     <input type="text" id="lname" name="city" placeholder="Your City.."><br>
<br>
<br>
    <label for="subject">Subject</label>
    <textarea id="subject" name="message" placeholder="Write something.." style="height:200px"></textarea>

    <input type="submit" value="Submit">
  </form>
</div>
<a href="https://wa.me/9989XXXXXXX" target="_blank">
 
<img src="https://bas.com/img/whatsapp-logo-icone.png" width="50px"></a>
</body>
</html>

260 Replies to “php registration form with all fields with file upload or resume upload”

  1. Hi there, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam comments?
    If so how do you protect against it, any plugin or anything you can advise?
    I get so much lately it’s driving me crazy so any support is very much appreciated.

  2. Please let me know if you’re looking for a author for your
    blog. You have some really good articles and I think I would be a good asset.
    If you ever want to take some of the load off, I’d love to
    write some material for your blog in exchange
    for a link back to mine. Please blast me an email if
    interested. Thank you!

    Feel free to surf to my page; BUY RIVOTRIL

  3. Hi! Do you know if they make any plugiins
    tto assist with Search Engine Optimization? I’m tryinjg to get my blog to rank for some targeted keywords but I’m not seeing very good results.
    If you know oof any please share. Kudos!

    my web-site … BUY VIAGRA ONLINE

  4. Greetings from California! I’m bored at work so I decided to check
    out your website on my iphone during lunch break. I really like the
    info you present here and can’t wait to take a look when I get home.
    I’m shocked at how fast your blog loaded on my mobile .. I’m
    not even using WIFI, just 3G .. Anyways, fantastic blog!

    Stop by my web-site; BRAND NEW PORN SITE SEX

  5. This design is steller! You most certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start my own blog
    (well, almost…HaHa!) Fantastic job. I really enjoyed what you had to say, and more than that,
    how you presented it. Too cool!

    Also visit my webpage … Sex ads

  6. Взрослый контент доступны на различных сайтах для взрослых в развлекательных целях.
    Всегда выбирайте надежные сайты для взрослых для защищенного опыта.

  7. Explore the freedom of Buy Fentanyl Without Prescription, your trusted source for quick
    solutions! Shop a user-friendly platform offering premium
    fentanyl, sourced to fulfill your expectations.
    Whether you’re addressing relief for your ongoing challenges, our swift service delivers confidentially
    with total privacy. Visit for instant access to verified
    products, uplifting your needs anytime.
    Why wait when you can streamline your experience with Buy Fentanyl Without
    Prescription? Our vast inventory connects you to safe products at budget-friendly prices, with lightning-fast delivery
    to satisfy your needs. Browse with confidence on our intuitive
    platform, updated frequently to ensure reliable stock.
    No barriers—just quick access to the support you seek. Click now
    and redefine your experience today!

  8. Hey there! Do you know if they make any plugins to help
    with Search Engine Optimization? I’m trying to get my blog to rank for
    some targeted keywords but I’m not seeing very good gains.
    If you know of any please share. Many thanks!

  9. Amazing! This website is truly great! The library of
    shemale porn videos is unbelievable – so many stunning trans girls in premium scenes.

    The streaming is fast and flawless and new clips are added every day.

    If you’re searching for a place to watch shemale fucks guy porn videos featuring hot performers and intense action, this is hands down the perfect spot.
    Strongly recommended!

  10. Fantastic! This platform is seriously addictive!

    The selection of shemale porn videos is unbelievable – tons of sexy trans girls in high-quality scenes.
    The streaming is butter-smooth and new videos
    are added every day.
    If you’re looking to watch Asian Shemale porn videos featuring
    hot performers and raw action, this is definitely the best spot.
    Strongly recommended!

  11. Fantastic! This site is absolutely great! The selection of shemale blowjob porn videos is unbelievable – so many stunning trans girls in high-quality scenes.
    The loading is butter-smooth and new videos are
    added all the time.
    If you’re searching for a place to watch shemale porn videos featuring seductive performers and raw action, this
    is without a doubt the ultimate spot. Totally recommended!

  12. Найдите контент для взрослых, исследуя надежные платформы
    в Интернете. Изучите надежные порнохабы для приватного просмотра.

    Feel free to visit my website BUY VIAGRA

  13. Fantastic! This site is truly addictive! The
    library of tranny porn videos is insane – so many gorgeous trans girls
    in premium scenes. The playback is fast and flawless and new clips are added all the time.

    If you’re want to watch shemale fucks Guy porn videos featuring hot performers and
    intense action, this is definitely the ultimate spot.
    Strongly recommended!

  14. Премиум xxx платформы предлагают высококачественный контент для
    взрослых развлечений. Выбирайте гарантированные платформы для безопасного
    и приятного просмотра.

    Feel free to visit my web page ORGY PORN VIDEOS

  15. Have you ever considered about including a little bit more than just your articles?
    I mean, what you say is valuable and all.
    But imagine if you added some great images or video clips to give your posts more,
    “pop”! Your content is excellent but with pics and clips,
    this site could definitely be one of the best in its niche.
    Superb blog!

    Here is my website: transexual porn sex videos

  16. Amazing! This platform has the top deep anal free russian porn!

    The girls get their asses stretched and the video quality is insane.

    Finally found a site with real rough anal action. Gaping and creamy creampies.

    Best anal porn collection I’ve come across. The scenes are
    so wild and the girls look incredible.

    These anal sex porn videos are insane. Passionate and mind-blowing.
    Streaming works perfectly.

    Wild anal action! Tight asses getting railed in the filthiest
    way.

    Totally recommended! My go-to site!

  17. Holy shit! This site has the top ass fucking clips!

    The girls take it so deep and the quality is top notch.

    Finally found a site with real rough anal action. Deep penetration and messy creampies.

    Greatest anal porn collection I’ve come across. The scenes
    are so brutal and the girls look incredible.

    These hardcore anal clips are out of this world.

    Rough and mind-blowing. Streaming works perfectly.

    Unbelievable anal action! Tight asses getting destroyed in the hottest way.

    Strongly recommended! Best anal porn ever!

    Also visit my blog; Free Russian Porn

Leave a Reply

Your email address will not be published. Required fields are marked *