Luqman Rosli
Luqman Rosli

Reputation: 31

How do i insert php code for time in my form?

I'm currently having trouble with my final year project, one of the form made for reservation has no time input, how do i insert the code and integrate it with my database?

Here's my reservation form code :


<div class="a"> <b> Fill In The Appointment Form </b> </div> <br>
<hr size="3" width="50%" color="black">

<form action="pros_form_app.php" method="post" enctype="multipart/form-data" name="form1">
  <br> <br> <br> <br> <br>
  <table width="700" bgcolor="#FFFFFF" border="1" bordercolor="#000000" align="center" background="img/bluee.png">
    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> FIRST NAME  </td>
          <td width="10" bgcolor="#FFFFFF">:</td>
          <td bgcolor="#FFFFFF"><input name="FirstName" type="text" id="FirstName" size="50" placeholder="Your First name.." /></td>
          </tr>
          
          <tr>
          <td colspan="3" bgcolor="#3399ff"> <b> LAST NAME </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF"><input name="LastName" type="text" id="LastName" size="50" placeholder="Your Last name.." /></td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> EMAIL </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF"><input name="Email" type="text" id="Email" size="50" placeholder="Your Email.." /></td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> DATE </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#b3d9ff"><input type="Date" id="Date" name="Date" placeholder="Select a date.."></td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> APPOINTMENT </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF">
        <select id="Appointment" name="Appointment">
          <option value="health"> Premium Healthcare </option>
          <option value="weight"> Weight Loss Program </option>
          <option value="wrinkles"> Wrinkles and Fine Lines </option>
          <option value="hair"> Hair Loss Treatment </option>
        </select>
      </td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> MESSAGE </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF"><input name="Message" type="text" id="Message" size="500" placeholder="Your Message.." /></td>
    </tr>

    <tr>
      <td colspan="10" bgcolor="#c5e8ec" align="center">
        <br>
        <input name="hantar" type="submit" id="hantar" value="SUBMIT" />
        <br> <br>
      </td>
    </tr>

Upvotes: 3

Views: 98

Answers (3)

seema
seema

Reputation: 354

try this,

<tr>
      <td colspan="3" bgcolor="#3399ff"> <b> DATE & Time </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#b3d9ff"><input type="datetime-local" id="Date" name="Date" placeholder="Select a date and time"></td>
    </tr>

or

<tr>
  <td colspan="3" bgcolor="#3399ff"> <b> DATE </b> </td>
  <td width="10" bgcolor="#FFFFFF">:</td>
  <td bgcolor="#b3d9ff"><input type="Date" id="Date" name="Date" placeholder="Select a date.."></td>
</tr>

 <tr>
  <td colspan="3" bgcolor="#3399ff"> <b> Time </b> </td>
  <td width="10" bgcolor="#FFFFFF">:</td>
  <td bgcolor="#b3d9ff"><input type="time" id="time" name="time" placeholder="Select time"></td>
</tr>

Upvotes: 2

falconimogollon
falconimogollon

Reputation: 111

there it is. I would recommend you to add required inside the input tags, that means if the box has no info, the form won't continue, Like this <input type="text" required>


<div class="a"> <b> Fill In The Appointment Form </b> </div> <br>
<hr size="3" width="50%" color="black">

<form action="pros_form_app.php" method="post" enctype="multipart/form-data" name="form1">
  <br> <br> <br> <br> <br>
  <table width="700" bgcolor="#FFFFFF" border="1" bordercolor="#000000" align="center" background="img/bluee.png">
    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> FIRST NAME  </td>
          <td width="10" bgcolor="#FFFFFF">:</td>
          <td bgcolor="#FFFFFF"><input name="FirstName" type="text" id="FirstName" size="50" placeholder="Your First name.." /></td>
          </tr>
          
          <tr>
          <td colspan="3" bgcolor="#3399ff"> <b> LAST NAME </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF"><input name="LastName" type="text" id="LastName" size="50" placeholder="Your Last name.." /></td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> EMAIL </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF"><input name="Email" type="text" id="Email" size="50" placeholder="Your Email.." /></td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> DATE </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#b3d9ff"><input type="datetime-local" id="Date" name="Date" placeholder="Select a date.." required></td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> APPOINTMENT </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF">
        <select id="Appointment" name="Appointment">
          <option value="health"> Premium Healthcare </option>
          <option value="weight"> Weight Loss Program </option>
          <option value="wrinkles"> Wrinkles and Fine Lines </option>
          <option value="hair"> Hair Loss Treatment </option>
        </select>
      </td>
    </tr>

    <tr>
      <td colspan="3" bgcolor="#3399ff"> <b> MESSAGE </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF"><input name="Message" type="text" id="Message" size="500" placeholder="Your Message.." /></td>
    </tr>

    <tr>
      <td colspan="10" bgcolor="#c5e8ec" align="center">
        <br>
        <input name="hantar" type="submit" id="hantar" value="SUBMIT" />
        <br> <br>
      </td>
    </tr>

Upvotes: 1

minion
minion

Reputation: 151

<tr>
      <td colspan="3" bgcolor="#3399ff"> <b> Arrival </b> </td>
      <td width="10" bgcolor="#FFFFFF">:</td>
      <td bgcolor="#FFFFFF"><input name="time" type="text" id="time" size="50" placeholder="What time are you checking in?"/></td>
      </tr>

In your database put it as varchar if you only need information about time and not do anything else with it, couse in that case i wouldn't suggest varchar

Upvotes: 2

Related Questions