Re: [PHP] strange problem (user poll)
Hello Paul, well problem is this: you don't have defined variable $actionmaybe you are not posting it correctly from form...what is on first 12 lines? try to add $action=value; on line 12...just define any suitable value... -- Best regards, Martin mail [EMAIL PROTECTED] mobile +421.907.303.393 icq34358414 wwwhttp://www.corwin.sk PGP key fingerprint 21365ca05ecfd8aeb1cf19c838fff033 In those days spirits were brave, the stakes were high, men were real men, women were real women and small furry creatures from Alpha Centauri were real small furry creatures from Alpha Centauri. by Douglas Adams Wednesday, January 8, 2003, 11:43:12 PM, you wrote: PF Can anyone see a problem in this? When i run the script i am getting this PF error Notice: Undefined variable: action in PF C:\www\Apache2\htdocs\user_poll\2\addpoll.php on line 13 PF ? PF // addpoll.php PF // Case Study 1: User Poll - Foundation PHP for Flash PF // If the form has been submitted... PF (line 13) if ($action == add) { PF // Include config file PF include('common.php'); PF // Connect to database PF $link = dbConnect(); PF // Get date for new poll PF $posted = time(); PF // Build query to insert new poll PF $query = INSERT INTO polls (question, option1, option2, option3, PF posted) PF VALUES('$question', '$option1', '$option2', '$option3', PF $posted); PF // Execute query PF $result = @mysql_query($query); PF // If query failed... PF if (!$result) { PF // Display error PF print font color=\#ff\Could not insert poll/fontbr\n; PF } else { PF print font color=\#ff\Poll added/fontbr\n; PF } PF mysql_close($link); PF } ? PF please anyone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] strange problem (user poll)
You need to check like this: if (isset($action) $action == 'add') AND if it is 4.1 + and global vars are turned off?? if (isset($_GET['action']) $_GET['action'] == 'add') ** The above will need to changed if it is POST in the above example!! Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: - [ Paul Ferrie ] - [mailto:[EMAIL PROTECTED]] Sent: Thursday, 9 January 2003 8:43 AM To: [EMAIL PROTECTED] Subject: [PHP] strange problem (user poll) Can anyone see a problem in this? When i run the script i am getting this error Notice: Undefined variable: action in C:\www\Apache2\htdocs\user_poll\2\addpoll.php on line 13 ? // addpoll.php // Case Study 1: User Poll - Foundation PHP for Flash // If the form has been submitted... (line 13) if ($action == add) { // Include config file include('common.php'); // Connect to database $link = dbConnect(); // Get date for new poll $posted = time(); // Build query to insert new poll $query = INSERT INTO polls (question, option1, option2, option3, posted) VALUES('$question', '$option1', '$option2', '$option3', $posted); // Execute query $result = @mysql_query($query); // If query failed... if (!$result) { // Display error print font color=\#ff\Could not insert poll/fontbr\n; } else { print font color=\#ff\Poll added/fontbr\n; } mysql_close($link); } ? please anyone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange problem (user poll)
I have no idea what I did but this email was not supposed to go to the list.. my apologies. *LOL* -Kevin - Original Message - From: Kevin Stone [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 08, 2003 4:18 PM Subject: Fw: [PHP] strange problem (user poll) [EMAIL PROTECTED] It would help to know where $action is being defined. - Original Message - From: - [ Paul Ferrie ] - [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 08, 2003 3:43 PM Subject: [PHP] strange problem (user poll) Can anyone see a problem in this? When i run the script i am getting this error Notice: Undefined variable: action in C:\www\Apache2\htdocs\user_poll\2\addpoll.php on line 13 ? // addpoll.php // Case Study 1: User Poll - Foundation PHP for Flash // If the form has been submitted... (line 13) if ($action == add) { // Include config file include('common.php'); // Connect to database $link = dbConnect(); // Get date for new poll $posted = time(); // Build query to insert new poll $query = INSERT INTO polls (question, option1, option2, option3, posted) VALUES('$question', '$option1', '$option2', '$option3', $posted); // Execute query $result = @mysql_query($query); // If query failed... if (!$result) { // Display error print font color=\#ff\Could not insert poll/fontbr\n; } else { print font color=\#ff\Poll added/fontbr\n; } mysql_close($link); } ? please anyone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php