Nerd Paradise
Home
About
Puzzles
Math
Programming
Origami
Japanese
MSPaint
Home > Programming > Page Validation with PHPSESSID

Page Validation with PHPSESSID

So you want to write a validating page in PHP with sessions? Good for you. But there's one problem. Each time you try to validate, all your links that have a parameter in them have a &PHPSESSID= tacked onto the end of it. That & breaks the validation and you're doomed!

What are you going to do? Pack up and go home? Not so fast!

Simply add the following line to the top of your PHP code before all that session stuff happens...

ini_set('arg_separator.output',"&");


Phew, you're safe. But wait! Right when you thought PHPSESSID wouldn't give you anymore trouble, you make a page with a form. Now it's putting a hidden field right after your <form> tag and it breaks validation again!

Spray some of this at the top of your code...

ini_set('url_rewriter.tags', "a=href, area=href, frame=src, fieldset=");

And the world is safe, once again.

You are visitor #000964
Get notified about new posts by following the newfangled twitter account.
Best viewed with
© 1999 Nerd Paradise