Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:37:44+00:00 2026-05-31T13:37:44+00:00

I am making a registration form in PHP and when submitting the form Date(Check

  • 0

I am making a registration form in PHP and when submitting the form Date(Check In, for which I have used Date Picker), Combo boxes(Sex & Room No) & check box(taxi) is not getting inserted.

I have looked enough in to the code but not getting what is wrong..though other combo box and check box working just fine.

PHP Code –

<?php

$passport = $_POST['passport'];
$name = $_POST['name'];
$sex = $_POST['sex'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$country = $_POST['country'];
$contact = $_POST['contact'];
$email = $_POST['email'];
$roomNo = $_POST['roomNo'];
if(isset($_POST['food']) && $_POST['food'] == 'food')
{
    $food = 'yes';
}
else
{
    $food = 'no';
}   
if(isset($_POST['car']) && $_POST['car'] == 'car')
{
    $car = 'yes';
}
else
{
    $car = 'no';
}
if(isset($_POST['others']) && $_POST['others'] == 'others')
{
    $others = 'yes';
}
else
{
    $others = 'no';
}
$checkIn = $_POST['checkIn'];


mysql_connect("localhost","root","");
mysql_select_db("guesthouse");

$personal_query = "INSERT INTO personal_details VALUES(
                                                        '',
                                                        '$name',
                                                        '$sex',
                                                        '$address1',
                                                        '$address2',
                                                        '$city',
                                                        '$country',
                                                        '$contact',
                                                        '$email')";
mysql_query($personal_query);
$result = mysql_affected_rows();

if($result == 1)
{
    echo "Personal Details Submitted";
}

$booking_query = "INSERT INTO booking VALUES(
                                                '',
                                                '$name',
                                                '$roomno',
                                                '$food',
                                                '$taxi',
                                                '$others',
                                                '$checkIn')";

mysql_query($booking_query);
$result = mysql_affected_rows();

if($result == 1) {
    echo "<br/>Booking Details Submitted";
}    
?>

HTML –

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
    window.onload = function(){
        new JsDatePick({
            useMode:2,
            target:"checkIn",
            dateFormat:"%d-%M-%Y"
            /*selectedDate:{                
                day:5,                  
                month:9,
                year:2006
            },
            yearsRange:[1978,2020],
            limitToToday:false,
            cellColorScheme:"beige",
            dateFormat:"%m-%d-%Y",
            imgPath:"img/",
            weekStartDay:1*/
        });
    };
</script>
</head>
<form name="form1" method="post" action="registration_handle.php">
  <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td colspan="2" align="center" bgcolor="#0099FF">Room Reservation Details :</td>
    </tr>
    <tr>
      <td width="33%" align="center" bgcolor="#66FFCC">Passport No </td>
      <td width="67%"><label for="textfield"></label>
      <input type="text" name="passport" id="passport"></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">Name</td>
      <td><input type="text" name="name" id="name"></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">Sex</td>
      <td><label for="select3"></label>
        <select name="sex" id="sex">
        <option value="" selected>Male</option>
        <option value="" >Female</option>
      </select></td>
    </tr>

    <tr>
      <td align="center" bgcolor="#66FFCC">Address 1</td>
      <td><input type="text" name="address1" id="address1"></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">Address2</td>
      <td><input type="text" name="address2" id="address2"></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">City</td>
      <td><input type="text" name="city" id="city" /></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">Country</td>
      <td><label for="select2"></label>
        <select name="country" id="country">
        <?php
            mysql_connect("localhost","root","");
            mysql_select_db("guesthouse");

            $query = "SELECT name FROM country";
            $query_result = mysql_query($query);
            while($result = mysql_fetch_assoc($query_result))
            {
            ?>
                <option value = "<?php echo $result['name'] ?>"><?php echo $result['name'] ?></option>
            <?php
            }       
        ?>
      </select></td>
    </tr>

    <tr>
      <td align="center" bgcolor="#66FFCC">Contact No</td>
      <td><input type="text" name="contact" id="contact"></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">E-Mail </td>
      <td><input type="text" name="email" id="email"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">Room No</td>
      <td><label for="select4"></label>
        <select name="roomNo" id="roomNo">
        <?php
            mysql_connect("localhost","root","");
            mysql_select_db("guesthouse");

            $query = "SELECT name FROM roomno";
            $query_result = mysql_query($query);
            while($result = mysql_fetch_assoc($query_result))
            {
            ?>
                <option value = "<?php echo $result['name'] ?>"><?php echo $result['name'] ?></option>
            <?php
            }       
        ?>
      </select></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">Extra Service</td>
      <td><p>
        <label>        </label>
        <input type="checkbox" name="food" value="food" />Food  
        <input type="checkbox" name="car" value="car" />Car 
        <input type="checkbox" name="others" value="others" />Others<br>
      </p></td>
    </tr>
    <tr>
      <td align="center" bgcolor="#66FFCC">Check In </td>
      <td><label for="textfield3"></label>
      <input type="text" size="16" name="checkIn" id="checkIn"></td>
    </tr>

    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Submit">
      <input type="reset" name="Reset" id="Reset" value="Reset" />
      <input type="submit" name="cancel" id="cancel" value="Cancel" /></td>
    </tr>
  </table>
</form>

</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:37:45+00:00Added an answer on May 31, 2026 at 1:37 pm

    value of sex is "" (if you want default, don’t type value=””)
    -Tested-

    <html>
    <body>
    
    <select onchange="alert(this.value);">
      <option>Volvo</option>
      <option>Saab</option>
      <option value=''>Mercedes</option>
      <option>Audi</option>
    </select>
    
    </body>
    </html>
    

    you never give any value to $taxi (wich is called car in your form)

    You initialte $roomNo and store $roomno

    — found these errors because I tend to do same things. here’s a tip, always verify your variables name first, 99% of your probs will be fixed — (works for me 🙂 )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a registration form which will have the user put in his birthday.
I'm making a registration form and I want to check if the user has
I am making a registration table which will check if the cellphone number typed
I am making a registration/login system with php. I think I have all the
I have made a registration program. Making use of mysql database. Can I still
I have a registration form that when the user enters in valid registration data
I'm making a registration form for my users and I'd like them to write
Im making a registration script for my site and i want to check if
I am making a registration form. When a user is selecting a username I
I'm making a registration form, my only doubt is how to handle passwords (how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.