cscartman
04-30-2003, 01:15 PM
Is there a way i can save a cookie with a form that targets a iframe? Because i used to cookies with php but it wont save :( can i get some help?? please!!!
|
Click to See Complete Forum and Search --> : saveing cookies with a form? cscartman 04-30-2003, 01:15 PM Is there a way i can save a cookie with a form that targets a iframe? Because i used to cookies with php but it wont save :( can i get some help?? please!!! Jona 04-30-2003, 01:20 PM I've used Javascript session cookies on this (http://jona.t35.com/mjdimick.html) form. cscartman 04-30-2003, 01:30 PM the problem with useing php is that the form doesnt post from that page it targets the iframe and goes to the post page and is supposed to set the cookie but it doesnt :( and its weird because im useing the same computer to save cookies and this just wont :( Jona 04-30-2003, 01:31 PM It is essential, for help, to post your code--PHP, Javascript, HTML, CSS, everything. cscartman 04-30-2003, 01:36 PM //pbox.php <? include("ip.php"); ?> <html> <head> <title><? print("$sitetitle"); ?></title> <? include("config.php"); ?> </head> <body bgcolor=black text=white> <center> <iframe src=veiw.php width=200 height=200 name=iframe></iframe> <table> <form action=post.php target=iframe> <tr><td><? print("$fname"); ?></td><td><input type=text name=nameval value=<? print("$nameval"); ?>></td></tr> <tr><td><? print("$femail"); ?></td><td><input type=text name=emailval value=<? print("$emailval"); ?>></td></tr> <tr><td><? print("$fmsg"); ?></td><td><input type=text name=msgval></td></tr> <tr><td><input type=submit value="<? print("$fbutton"); ?>"></td></tr> </form> </center> </table> <? include("footer.php"); ?> //post.php <?php print("<font color=white>"); if ($nameval == "") { exit("<font color=red>Please enter a name!</font> <a href=veiw.php>Go back</a>"); } if ($emailval == "") { exit("<font color=red>Please enter a email! <a href=veiw.php>Go back</a>"); } if ($msgval == "") { exit("<font color=red>Please enter a message! <a href=veiw.php>Go back</a>"); } else { print("<font color=white>"); setcookie("nameval","$nameval",time()+3600); setcookie("emailval","$emailval",time()+3600); include("bbcodes.php"); $file = "chatdata.dat"; $new = $date_array[0] + $time_a; $date = date("m/d @ $new:i", time()); print "<meta http-equiv=\"refresh\" content=\"0; URL=veiw.php\">"; $fp = fopen ($file, "r+") or die ("error when opening $file"); flock($fp,2); $old=fread($fp, filesize($file)); rewind($fp); fwrite ($fp, "<span alt=$date><b><</b><a href=mailto:$emailval>$nameval</a><b>></b><br>$msgval</span><br><br>\n".$old); flock($fp,3); fclose ($fp); } ?> cscartman 04-30-2003, 01:38 PM the problem is i cant get the cookie to show on pbox.php my cookies r enabled and everything but they seem not to work with this code :( Jona 04-30-2003, 01:41 PM setcookie("nameval", $nameval, time()+3600); setcookie("emailval", $emailval, time()+3600); Try taking out the quotes. They aren't necessary--$nameval and $emailval are variables. Jona 04-30-2003, 01:42 PM Also, try: http://www.php.net/manual/en/function.setcookie.php cscartman 04-30-2003, 01:45 PM Still dont work it wont save the cookies can it be because im not posting on that perticular page? and posting to the iframe? because i no that the shoutbox that u can get remotly hosted does that and it saves the cookies Jona 04-30-2003, 01:47 PM When/where are you reading the cookies that you set? cscartman 04-30-2003, 01:50 PM im reading the cookies on pbox.php but they dont show up on that page but they show up on veiw.php that i have in a iframe and i dont no how to take this one script i found on javascriptsource.com instead of it haveing a prompt use a form but i just mess it up lol Jona 04-30-2003, 01:52 PM Whoa, that was hard to read... Try using commas and periods more often (but not too often). Try searching http://php.net/ for some information on reading cookies. cscartman 04-30-2003, 01:55 PM sorry my english sux :( but i have tried searching for reading cookies i guess php cant show cookies that r posted on one page and read from another webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |