php - store entry to database according to my selection from drop down menu -


I'm happy to ask you again, I have an Employee Leave Registration page that includes 5 fields "Employee's Name is included "," type of vacation "(one day holiday, part day holiday, long day break)," date of leave "(one day holiday and part of the holiday of the day) , "To" & Amp; If the insert date is long term leave) and the final area is "to" (if the included hours are part of the holiday of the day & amp; insert date then long term leave)

There is no need to make the database (from "to" and "to" fields) if one day's holiday is chosen to put these data in my database according to the selection of the type of holiday. Just do Chari's name, a day off, and put on the spot.

And if I chose part of the day off, then I must enter the name of the employee, the type of vacation = the day of the day, the date of the holiday, and the last 2 areas should be entered as hours , 08:30 am and T o = 10:30 am

And if I choose a long day holiday then I have to enter the name of the employee, the type of vacation = long days, the date of the holiday and the last 2 fields which I have already chosen it To: = 10/9/2014 and from = 11/9/2014.

This is a part of my work, but I can not work it in a query $ employee_name = $ _ post ['employee_name']; $ Today = Date ("D / M / Y"); // Holiday date $ vacation = $ _ POST ['vacation']; // Part day, one day and long term leave $ start_hour = $ _ POST ['start_hour']; // If I select the part of the holiday hours from drop list $ end_hour = $ _ POST ['end_hour']; // If I select the part of the holiday hours from drop list $ day_start = $ _ POST ['day_start']; // If I select a long-term holiday from the drop list $ day_end = $ _ POST ['day_end']; // If I select a long term holiday from the drop list

What should I do in the query given below,

  $ sql = "INSERT $ long, '$ end_hour' $ v_ty_table value ('$ employee_name', '$ vacation', '$ today', '$ start_hour'- if part-time and' $ day_start 'if part-time and' $ day_end ' for a long time) "; $ Result = mysql_query ($ SQL);   

I know that this was a very long question but I hope you want to forgive me since joining this area and thank you very much for helping me It is said

From your code, it appears that your database only has a date field. You should start_date and end_date , depending on your terms.

The following code ensures that the data is valid and incorporates it.

You only need one table

  if ($ vacation == 'one day') {$ start_hour = ''; $ End_hour = ''; $ Day_start = $ _POST ['day_start']; // If I select a long-term holiday from the drop list $ day_end = $ _POST ['day_start']; } // For the day, the expiration date is the same as the start date ($ vacation == 'day of the day') {$ day_end = $ _POST ['day_start']; } Include VALUES ('$ employee_name', '$ vacation', '$ employee_name'), $ Sql ​​= "` holidays` (`name`,` type`, 'start_data`,' end_data`, 'start_hort', 'end_her') '$ day_start', '$ Day_end', '$ start_hour', '$ end_hour') "; $ Result = mysql_query ($ sql); You can also do  start_date  and  end_date  as the datetime field, and do something like this:  
  if ($ holiday == 'one day') {$ day_start = $ _POST ['day_start']; // If I select a long-term holiday from the drop list $ day_end = $ _POST ['day_start']; } // For the day, the expiration date is the same as the start date ($ vacation == 'day of the day') {$ day_end = $ _POST ['day_start']; } $ Day_start = ''. $ _POST ['START_HOUR']; $ Day_end = ''. $ _POST ['END_HOUR'];   

then include

  $ sql = "holidays" (`name`,` type ',' start_data`, 'and_data`) in VALUES ( '$ Employee_name', '$ vacation', '$ day_start', '$ day_end') "; $ result = mysql_query ($ sql);    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -