Page 1 of 1

Parse error:

Posted: Tue May 12, 2009 8:37 am
by fipp
I am receiving the following error: I am not sure what is wrong. Any help would be appreciated.

Parse error: syntax error, unexpected T_IF in /home/content/d/a/v/html/goal_forms/goalnext.php on line 17

Here is goalnext.php

Code: Select all

<?php
include("../member_pages/session.php");
include("../dbconnection/dbconnection.php");
session_start();
 
//test to make sure none of the fields are empty
$goalis=$_POST[goalis];
$goaltimeframe=$_POST[goaltimeframe];
$goalfeel=$_POST[goalfeel];
$goalsmell=$_POST[goalsmell];
$goalsound=$_POST[goalsound];
$goalpeople=$_POST[goalpeople];
$goalaccomplishedwhen=$_POST[goalaccomplishedwhen];
$userid=$_SESSION['userid']
 
//check to make sure all boxes are filled out.
if($goalis && $goaltimeframe && $goalfeel && $goalsmell && $goalsound && $goalpeople && $goalaccomplishedwhen){
 
        //insert data into database
        $sql="INSERT INTO goal SET userid=$userid, goalis='$goalis', goaltimeframe='$goaltimeframe', goalfeel='$goalfeel', goalsmell='$goalsmell', goalsound='$goalsound', goalpeople='$goalpeople', goalaccomplishedwhen='$goalaccomplishedwhen'";
        $result=mysql_query($sql);
        
            if($result){
 
                        header("/stepform.php");
                    
                    }else{
                        echo "Cannot currently enter your information.";
                        }
                        
                        
            
}else{
    echo "You must complete the entire form in order to submit this page. Please click the Back button make sure everything is filled out and try again.";
        }       
 
?>


here is some code from the form that is being sent to the php

Code: Select all

<form name="goal" method="post" action="/goal_forms/goalnext.php">

Code: Select all

<fieldset>
        <legend>My goal is to:</legend>                                                                                                                 
            <textarea name="goalis" cols="90" rows="4" wrap="virtual"></textarea>
        </fieldset>

Re: Parse error:

Posted: Tue May 12, 2009 8:44 am
by Hightower
Semi-colon missing on line 15?

EDIT: Meant line 14.

Re: Parse error:

Posted: Tue May 12, 2009 12:55 pm
by fipp
sorry my original message said line 15. The error message actually says line 17. I don't know if a semicolon is missing but I don't think so? below is the error line.

Code: Select all

if($goalis && $goaltimeframe && $goalfeel && $goalsmell && $goalsound && $goalpeople && $goalaccomplishedwhen){

Re: Parse error:

Posted: Tue May 12, 2009 1:01 pm
by divito
If it says you're missing it on line 17, it's essentially the last place you assigned a variable or echoed something, etc...

This is the line that is missing it:

Code: Select all

$userid=$_SESSION['userid']

Re: Parse error:

Posted: Tue May 12, 2009 1:05 pm
by fipp
Thank you very much. I appreciate it.

Re: Parse error:

Posted: Tue May 12, 2009 1:36 pm
by Hightower
divito wrote:If it says you're missing it on line 17, it's essentially the last place you assigned a variable or echoed something, etc...

This is the line that is missing it:

Code: Select all

$userid=$_SESSION['userid']
:? That's what I said wasn't it? :)

Re: Parse error:

Posted: Tue May 12, 2009 1:46 pm
by divito
You posed it as a question though. :wink:

Re: Parse error:

Posted: Tue May 12, 2009 1:56 pm
by Hightower
divito wrote:You posed it as a question though. :wink:
Awww shucks - I didn't want to be forceful though :P