question about header and validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1.
i have a question about using header("Location: filename.html"); in
php with my present code i have a few echo statements followed by
header("Location: filename.html"); because i have echo 

statements before header("Location: filename.html"); i am getting an
error that headers have already been sent. i cannot 

remove the echo statements as they are doing an important task. based
on this situation i can use echo followed by the html 

code for the filename in filename.html if i do this the code will run
into a few 100's of lines and due to this i would like 

to use header("Location: filename.html");

i have tried the following code and it works =

echo " <form name='errorpage' action='error.php' method='post'>
</form> 	  
       <script type='text/javascript' language='javascript'>
document.errorpage.submit(); </script> ";
however if javascript is turned off this redirection will not work.

could you please suggest if there is an alternative to using echo
statement first followed by 
header("Location: filename.html"); 

2.
i am using the following php validation for forms which is not working
very well

a)
$specialcharacters = '#^([a-zA-Z0-9]+)$#'; 
with this code for a name if i type "first name" with a space it is
considering the space and treating as a special character 

however it should validate for letters and numbers only. how can i
write '/^[a-zA-Z]+$/'; to ignore spaces


b)
$firstnamecheck = '/^[a-zA-Z]+$/';
with this code if i type for example "first name" as per the error is
states that the string needs to contain letters. though 

i typed letters because of the space it is not treating as letters.
how can i rewrite this '/^[a-zA-Z]+$/';

please advice.

thanks.



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux