RE: [PHP] mailing a cookiecontent

From: Date: Mon, 02 Sep 2002 17:44:42 +0000
Subject: RE: [PHP] mailing a cookiecontent
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-114944@lists.php.net to get a copy of this message
>Here's what I wanna do: >On the first page I collect a lot of formfield values into a cookie. On the >next page I display the content of this cookie. This works. >What I even want to do is mailing the cookie content in the same time I >submit the forms in the first page (or, when the new page loads). >I use this code on the second page: > >if ($REQUEST_METHOD=='POST') { > $name = escapeshellcmd($name); > $group = escapeshellcmd($group); > $to = "me@myhost.se"; > $from = "FROM: $name, $group"; > $subject = "The subject of this mail\n\n"; > $body = "Name: $name\t"; > $body .= "Group: $group\n"; > $body .= "\n\n$comments\n\n"; see below, but if you cookie is named cookiestr, just us the variable here $body .= "\n\n$cookiestr\n\n"; > > mail($to,$subject,$body,$from); > exit; >} > >Well, I recieve a mail, but the mailcontent is empty. >The cookie string is written to a hidden field like this: > > document.write('<FORM><INPUT TYPE=HIDDEN NAME=\"comments\" >VALUE=\"'+cookiestr+'\"></FORM>'); so your cookie variable name is "cookiestr" why use Javascript, and not just echo '<FORM><INPUT TYPE=HIDDEN NAME="comments" VALUE="'.$cookiestr.'"></FORM>'; Dave

« previous php.general (#114944) next »