PHP handling form inputs -
looking find out best way handle form inputs. firstly, form validated using javascript. presume validation done in php users disable javascript. @ moment getting inputs so
<?php $title = $_post['inputtitle']; $name = $_post["inputname"]; $surname = $_post["inputsurname"]; $email = $_post["inputemail"]; $link = $_post["inputlinks"]; if (isset($title) && isset($name) && isset($surname) && isset($email) && isset($link)) { //do }
is enough that? or should doing proper validation on email though done in javascript?
also, best add these inputs array? cant via html because needed give each input own unique name.
thanks
you should treat javascript validation "bonus" php validation must.
is better use empty() instead of isset() on input validation, since return true user not key in value.
if( !( empty($_post['inputtitle']) || empty($_post['inputname']) || empty($_post['inputsurname']) || empty($_post['inputemail']) || empty($_post['inputlinks']) ) ) { // continue validate inputemail using regular expression }
Comments
Post a Comment