[Admin Edit: This was moved from the reg globals sticky thread so the author's already read that.]
i've been reading through all these pages, and most of it is greek to me, so i haven't been able to figure out how to get variables that aren't in a form field. the thing I'm doing is generating a story from a number of variables and text. ex.
$Story = "the $animal_1 jumped over the $object_1";
now, I have a form on this page, that allows the user to e-mail the story to a friend, so how do I send the contents of $Story to the e-mail.php file, if $Story isn't a form object?
Thanks!
Jon
Problem with reg globals
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Have you tried setting $Story into a hidden form field so that it can be passed using the form?
Mac
Code: Select all
echo '<input type="hidden" name="Story" value="'.$Story.'" />';The way twiglet does it is right.
But if you want to really want to get around register globals then just paste this at the top of your page.
But if you want to really want to get around register globals then just paste this at the top of your page.
Code: Select all
<?php
foreach ($_POST as $key=>$val){
$$key = "$val";
}
foreach ($_GET as $key=>$val){
$$key = "$val";
}
?>- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
or
Code: Select all
extract($_POST);
extract($_GET);