RE: [PHP] Why won't this form post session variables?
| From: | Martin Towell | Date: | Mon, 22 Dec 2003 05:37:41 +0000 |
| Subject: | RE: [PHP] Why won't this form post session variables? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173128@lists.php.net to get a copy of this message | ||
I haven't used sessions before, but it doesn't look like the variables are
being put into the session.
If they're coming from a form, then they would appear in the $_POST or
$HTTP_POST_VARS variables, not the $HTTP_SESSION_VARS variable.
HTH
Martin
> -----Original Message-----
> From: Dave G [mailto:ml@autotelic.com]
> Sent: Monday, 22 December 2003 4:34 PM
> To: 'PHP General'
> Subject: [PHP] Why won't this form post session variables?
>
>
> PHP Gurus,
> I'm really stuck here. I've written the following code, and it
> will never execute the if statement. I keep getting the form
> displayed,
> and when I fill the form and hit the submit button, the
> HTTP_SESSION_VARS array does not seem to take any of the
> values set out
> in the form.
> Is there an error in this code? I've checked and double checked,
> but I can't see why the variables wouldn't post. Any advice much
> appreciated.
>
> session_start();
> if(isset($HTTP_SESSION_VARS['episodeTitle']) &&
> isset($HTTP_SESSION_VARS['episodePP']))
> {
> $episodePP=addslashes($HTTP_SESSION_VARS['episodePP']);
> $episodeTitle=addslashes($HTTP_SESSION_VARS['episodeTitle']);
> db_connect();
> $insertPPQuery = "INSERT INTO scripts (title, plotpoints) VALUES (" .
> $episodeTitle . ", " . $episodePP . ")";
> $insertPPResult = mysql_query($insertPPQuery);
> unset ($HTTP_SESSION_VARS['$episodeTitle']);
> unset ($HTTP_SESSION_VARS['$episodePP']);
> echo 'Your episode, "' . $episodeTitle . '", has been saved. Would you
> like to <a href="addplotpoint.php">add another episode</a>?';
> }
> else
> {
> echo 'Enter in a new episode in plot point form.<br><br>';
> echo '<form action="thispage.php" method="post"
> name="newPP"><br>';
> echo 'Title:<br>';
> echo '<input type="text" name="episodeTitle"
> size="75"><br>';
> echo 'Text:<br>';
> echo '<textarea name="episodePP" rows="10"
> cols="55"></textarea><br>';
> echo '<input type="submit" name="submitButton"
> value="Upload">';
> echo '</form>';
> }
>
> --
> Yoroshiku!
> Dave G
> ml@autotelic.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> __________ Information from NOD32 1.582 (20031218) __________
>
> This message was checked by NOD32 for Exchange e-mail monitor.
> http://www.nod32.com
>
>
>
>