Jump to content

PHP form validation


Deyaan

Recommended Posts

Hello people!

 

I'm new to coding and really need some help.

I want php to validate a form on submit.

 

I need somebody to make functions for validation and tell me how to implement them.

 

Form is named "formoklada" and I use POST.

I want to validate these things:

1st in field "ulog" I want the users to be able to enter only one number between 1 and 10 (including 1 and 10)

2nd I want that they check one of the radio buttons in group named "Tip" so there must be a value in "Tip"

3rd I want to limit submission possibility with date and time. Expiration date and time is in form "Date"

4th field "Id" must be other than 0

 

I was struggling with this for a while now and am going nuts. It's too complicated for me so I gave up.

 

If there is somebody willing to help, please do so!

 

Thank you very much!

Link to comment
https://forums.phpfreaks.com/topic/166518-php-form-validation/
Share on other sites

1:

if(is_numeric($ulog) && $ulog >= 1 && $ulog <= 10)

2:

Radio buttons can be tricky, can't answer this one off the top of my head.

3:

I don't understand the question. However, for validating all dates/times, just use a timestamp:

time();

4:

if($id != 0)

Link to comment
https://forums.phpfreaks.com/topic/166518-php-form-validation/#findComment-878130
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.