php - Using session to return message only returns one message -
so have sign form. 1 register.php
, actual form. , other r.php
, process it. use sessions send error message r.php
register.php
. issue reason can figure out how display one
if($name === ''){ $_session['name_req'] = 'make sure enter name'; header('location: register.php'); exit(); } elseif($name > 255){ $_session['name_len'] = 'enter shorter name'; header('location: register.php'); exit() }
this code sends message register.php
display error
<?php echo isset($_session['name_req']) ? $_session['name_req'] : '';?>
the issue if it'll display 1 error @ time , want display of them @ once. ideas?
with code supply, page redirects if 1 error found, try instead:
if(isset($_post['submitbuttonname']) && $_post['submitbuttonname'] == "submitbuttonvalue") { if($name === ''){ $_session['name_req'] = 'make sure enter name'; } if($name > 255){ $_session['name_len'] = 'enter shorter name'; } header('location: register.php'); exit(); }
but if use javascript submit form, submit button won't work, instead can use hidden input whatever name , value want.
Comments
Post a Comment