Validate that before time is greater than after time

i want to reserve the time slots. in php and it should be between 9.00 am to 5pm i want to validate the code using php plz tell me how to do. in php or using javascript

Since you want to reserve a time slot indicates you want to save to a database table in order to reference again indicates a server side language. Answer would be PHP though using javascript in addition could make it more dynamic for the user when it comes to validation. By that I mean the page wouldn’t reload it would look seamless. BTW you would have to use something like Ajax acting as the middleman. What I would do is get the PHP portion of the script to validate then incorporate JavaScript into the mix. That way if a user turns off javascript it will still validate.

Hopefully this topic should help @pam

      <div id="table1">
	  <table border=2 style='width:650px' style='margin-left:200px' cellspacing=2 cellpadding=5 align=center id='table' class='table table-hover'>
	 <tr>   <th align=center colspan="3"  bgcolor='#c6f2d1' ><font size=2.5> <center>TIME</center></font></th>  

                  </tr>
			

				   <tr>
       
        
         <th align=left ><font size=2><center>From</center></font></th>
         <th align=left ><font size=2><center>TO</center></font></th>
		 
      </tr>
	 
	 <tr>		  
	  <td><select name=from_time id=from_time><option value='9:00AM'>9:00 AM </option>
	                             <option value='10:00AM'>10:00 AM </option>
								 <option value='11:00AM'>11:00 AM </option>
								 <option value='12:00PM'>12:00 PM </option>
								 <option value='1:00PM'>1:00 PM </option>
								 <option value='2:00PM'>2:00 PM </option>
								 <option value='3:00PM'>3:00 PM </option>
								 <option value='4:00PM'>4:00 PM </option>
								 <option value='5:00PM'>5:00 PM </option>
								 
	  <select></td> 
	 <td><select name=to_time id=to_time  onblur=time_valid("from_time","to_time")><option value='9:00AM'>9:00 AM </option>
	                             <option value='10:00AM'>10:00 AM </option>
								 <option value='11:00AM'>11:00 AM </option>
								 <option value='12:00PM'>12:00 PM </option>
								 <option value='1:00PM'>1:00 PM </option>
								 <option value='2:00PM'>2:00 PM </option>
								 <option value='3:00PM'>3:00 PM </option>
								 <option value='4:00PM'>4:00 PM </option>
								 <option value='5:00PM'>5:00 PM </option>
								 
	  <select></td> 
	  <td> <input type="submit" id="add" class="button-add" name="add" value="add"></td>
	  </tr>
	 
	  </table>
  </div>
this is my code

i just want to validate it…
for example input should be like 9:00 am to 3:00Pm
den it is valid but if the input is 3:00pm to 1:pm then an alert must be there.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.