View Full Version : PHP parsing n00b
East High
July 14th, 2005, 04:32 PM
Hello,
I know very, very little when it comes to PHP. I've been using some of the tutes from the Flash section of this site to create Flash/PHP email forms and guest book forms. I've noticed that when the users type in their info and use quotes or parentheses it gets parsed as a backslash. I know that this has to do with the way PHP needs to be coded, but is there something I can do to fix this? Something simple I can put into the PHP code or some kind of filter?
Thanks,
GD
hl
July 14th, 2005, 04:35 PM
www.php.net/stripslashes
East High
July 15th, 2005, 03:51 PM
Thanks for the link, but I'm still confused. I'm afraid that I don't know enough about PHP to figure this out. I'm mainly a designer.... Which one of those bits of code should I use? Can I put in anywhere in the code? My code uses the $_POST method instead of $output if that helps/makes sense/ proves me a total idiot.
Here's my code:
<?php
$Website = eregi_replace("http://", "", $website);
if ($_POST["done"] == "Yes") {
$filename = "guest.txt";
$fp = fopen( $filename,"a");
$datePost = (date ("dS of F Y"));
$Input = "guest=".URLencode("<u>COOK:</u> ".
$_POST["name"].
"<br><br><u>RECIPE:</u> ".
$_POST["website"].
"<br><br><u>INGREDIENTS / PREPARATION:</u><br>".
$_POST["comments"].
"<br>Posted: ".
$datePost."<br><br>");
fwrite($fp,$Input,strlen($Input));
fclose($fp);
echo "confirm=success";
}
?>
Thanks again,
GD
East High
July 18th, 2005, 04:25 PM
*bump*
hl
July 18th, 2005, 06:40 PM
Thanks for the link, but I'm still confused. I'm afraid that I don't know enough about PHP to figure this out. I'm mainly a designer.... Which one of those bits of code should I use? Can I put in anywhere in the code? My code uses the $_POST method instead of $output if that helps/makes sense/ proves me a total idiot.
Here's my code:
<?php
$Website = eregi_replace("http://", "", $website);
if ($_POST["done"] == "Yes") {
$filename = "guest.txt";
$fp = fopen( $filename,"a");
$datePost = (date ("dS of F Y"));
$Input = "guest=".URLencode("<u>COOK:</u> ".
$_POST["name"].
"<br><br><u>RECIPE:</u> ".
$_POST["website"].
"<br><br><u>INGREDIENTS / PREPARATION:</u><br>".
$_POST["comments"].
"<br>Posted: ".
$datePost."<br><br>");
fwrite($fp,$Input,strlen($Input));
fclose($fp);
echo "confirm=success";
}
?>
Thanks again,
GD
<?php
$Website = eregi_replace("http://", "", $website);
if ($_POST["done"] == "Yes") {
$filename = "guest.txt";
$fp = fopen( $filename,"a");
$datePost = (date ("dS of F Y"));
$Input = "guest=".URLencode("<u>COOK:</u> ".
stripslashes($_POST["name"]).
"<br><br><u>RECIPE:</u> ".
stripslashes($_POST["website"]).
"<br><br><u>INGREDIENTS / PREPARATION:</u><br>".
stripslashes($_POST["comments"]).
"<br>Posted: ".
$datePost."<br><br>");
fwrite($fp,$Input,strlen($Input));
fclose($fp);
echo "confirm=success";
}
?>
East High
July 18th, 2005, 07:22 PM
wow. so it was just a matter of wrapping stripslashes() around the $_post[];
thanks! :beer:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.