Re: php 4.0.5 to php 4.2.2
| From: | Matt | Date: | Tue, 22 Apr 2003 23:04:29 +0000 |
| Subject: | Re: php 4.0.5 to php 4.2.2 | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27285@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Chris Mach" <cjmach@learn.senecac.on.ca>
To: <php-db@lists.php.net>
Sent: Tuesday, April 22, 2003 4:15 PM
Subject: Re: [PHP-DB] php 4.0.5 to php 4.2.2
> ok, let me see if i understand what your saying....
>
> so for $_POST['copy'] I have to go....
>
> $myrow['copy'] = $_POST['copy']
>
You have this code:
if ($submit) {
$sql = "INSERT INTO news (title,copy) VALUES
('$title','#~!&')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
?> <form method="post" action="<?php echo $PHP_SELF?>">
Enter Title:<br><input type="text"
name="title"><br>
Enter Copy:<br><textarea name="copy" cols="75"
rows="10"></textarea><br>
<input type="Submit" name="submit" value="Enter
information">
</form>
...
With register_globals off, each of the form values are in the variables
$_POST['title'], $_POST['copy'], and $_POST['submit'] and not
$title,$copy,
and $submit.
It might be easier for you if your on a Apache server to use a .htaccess
file and turn register_globals back on.
If you can't do that, then the sql needs to be changed to:
$sql = "INSERT INTO news (title,copy) VALUES
('{$_POST['title']}','$_POST['copy']')";
and any you have to find all of the references to the globals in the form
(and on every form).