using Predefined variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mordachai
Forum Newbie
Posts: 3
Joined: Mon Sep 26, 2005 3:58 am

using Predefined variables

Post by Mordachai »

I was wondering should I use $_POST throughout my script or should I first put the data in a normal var and use that one throughout my script? I mean like this

$var = $_POST["var"];

and use var from then on.

I can also do this no?
$_POST["var"] = "test";

But is it good or bad?

I need to be able to use the data of the post var as a normal var and I was wondering if this is ok or not.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Purely down to preference. Nothings right or wrong here BUT if you think about it it's better to copy it to a standard global first.

Reason... if you ever change the name of the input element or whatever and the POST var changes name, there's only one line to edit rather than multiple lines.
Post Reply