Page 1 of 1

using Predefined variables

Posted: Mon Sep 26, 2005 4:19 am
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.

Posted: Mon Sep 26, 2005 6:38 am
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.