Re: php forms



I noticed that Message-ID:
<ddhqdm$2mo$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> from Margaret
contained the following:

>I finally
>worked out, after some hours of wondering, that the input page won't
>accept a ' (quote) although when I make the same entry direct into
>PHPmyadmin it is OK.
>
>Any ideas (it doesn't matter too much, but it would be nice to know why)?

Does it just fail? If so, it sounds like magic quotes is set to off and
the quote marks need to be escaped. You may have to use the
addslashes() function on your input variables. Try this(untested):

foreach($_POST as $key=>$value){
$$key=addslashes($value);
}
$query = "INSERT INTO $table VALUES
('','$date','$time','$title','$description')";
if(mysql_query($query)){
echo"The event has been entered.";
}
else{
echo "Could not enter record";
}

mysql_close();
?>

If the slashes are showing in the output then you may need to use
stripslashes to get rid of them, but if you haven't noticed them before
when adding quotes using phpMyadmin, then the chances are that this
function is already used.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
.



Relevant Pages

  • Re: FW: Debian Testing VMWare-Tools Bad Variable Name
    ... for VMware Tools ... if it's referenced in that script, ... Sounds like an unescaped quote in one of these scripts, ... echo -n ' '"$msg" ...
    (Debian-User)
  • Re: Article/Repost: One Day at a Time
    ... ~Echo wrote: ... ""......Every day the ex-smoker should wake up thinking that he is not going ... For anyone who has quit smoking has broken free from a very ... [end quote] ...
    (alt.support.stop-smoking)
  • Re: Mail.app being blocked?
    ... They say I need an invitation. ... OT: Please learn to quote. ... from the practice of many AOL users in the ... Mail: echo 36199371860304980107073482417748002696458P|dc ...
    (comp.sys.mac.apps)
  • Re: iterating over bash script params, preserving whitespace?
    ... | say I've got a script containing the following: ... | echo second is $2 ... and with the quote characters included as part of the ... first second parameter This is third forth ...
    (comp.os.linux.misc)
  • Re: Should integer variables be quoted?
    ... and are sure that $IFS does not contain an integer, ... There's no need not to quote it either. ... echo "$)" ... you're requesting the shell to do word splitting, ...
    (comp.unix.shell)