Nerd Paradise
Home
About
Puzzles
Math
Programming
Origami
Japanese
MSPaint


Don't worry, I'm not selling anything. Just giving a shoutout to one of my open-source side projects:

I created a programming language for beginners and am looking for people to test it out. If you have a spare moment (particularly if you haven't programmed before) and you're interested in making 2D games, please check it out.


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 #002586
Get notified about new posts by following the newfangled twitter account.
Best viewed with
© 1999 Nerd Paradise