Is this right:
<input type = text name = $POST['variable']>
Or am I missing something?
THanks guys.
Is this right:
<input type = text name = $POST['variable']>
Or am I missing something?
THanks guys.
No, your form fields stay the same no matter what register_globals is set to. What changes is how you call it in your script.
So, your input would look like this:
<input type="text" name="variable">
and you'd call it in your script like this:
$_POST['variable']
Of course, this assumes that your have method="post" in your form tag, if not then call it like this:
$_GET['variable']
So once I use $_POST['variable'] in my script I'm free to use $variable as I wish in my script?
Try this:
<input type="text" name="variable" value="<? echo $_POST[variable]; ?>" >
$_POST[variable] has value only upon submission.
Subkida,
No you are not free to use $variable (from $_POST['variable']) if globals are off, unless you explicitly make that transformation:
$variable=$_POST['variable'];
You can achieve very similar results to having globals on by using the [man]extract()[/man] function on the whole $_POST array.
$variable=$_POST['variable'] wont' make it global, will it?
no, it wont. If you want to manipulate it from say, a function, you'll have to make it global yourself. $_POST however is a SuperGlobal, and as such, you can manipulate it from anywhere.
Ok well how would I do it if I wanted to permanently store the submitted information in a variable that I can pass through a function to another page.
I'm using it for a news table that you can change the content of by simply submitting new information to a variable and then passing it through a function to the news table to be displayed.
Thanks for the replies.
hi subkida,
I think this may have been confusing, "global" means that it can be accessed from anywhere within this scipt while the script is executed (which normally wouldn't be the case within functions).
there is no way to make variables persist between page calls. to achieve this, you would either need to pass them from page to page (via forms or links) or work with sessions.
hope I was able to explain it well.