Current location: Hot Scripts Forums » Programming Languages » PHP » Please Please Help!!!!


Please Please Help!!!!

Reply
  #1 (permalink)  
Old 03-19-10, 07:43 PM
jensende jensende is offline
New Member
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Stop Please Please Help!!!!

Can someone please help me with following error:

Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/

Here is the script:
PHP Code:

<? 


class Form
{
   var 
$values = array();  //Holds submitted form field values
   
var $errors = array();  //Holds submitted form error messages
   
var $num_errors;   //The number of errors in submitted form

   /* Class constructor */

   
function Form(){

      
/**
       * Get form value and error arrays, used when there
       * is an error with a user-submitted form.
       */

      
if(isset($_SESSION['value_array']) && isset($_SESSION['error_array'])){
         
$this->values $_SESSION['value_array'];
         
$this->errors $_SESSION['error_array'];
         
$this->num_errors count($this->errors);

         unset(
$_SESSION['value_array']);
         unset(
$_SESSION['error_array']);
      }

      else{

         
$this->num_errors 0;

      }
   }


   
/**
    * setValue - Records the value typed into the given
    * form field by the user.
    */

   
function setValue($field$value){
      
$this->values[$field] = $value;
   }

   
/**
    * setError - Records new form error given the form
    * field name and the error message attached to it.
    */

   
function setError($field$errmsg){
      
$this->errors[$field] = $errmsg;
      
$this->num_errors count($this->errors);
   }

   
/**
    * value - Returns the value attached to the given
    * field, if none exists, the empty string is returned.
    */

   
function value($field){
      if(
array_key_exists($field,$this->values)){
         return 
htmlspecialchars(stripslashes($this->values[$field]));
      }else{
         return 
"";
      }
   }


   
/**
    * error - Returns the error message attached to the
    * given field, if none exists, the empty string is returned.
    */

   
function error($field){
      if(
array_key_exists($field,$this->errors)){
         return 
"<font size=\"2\" color=\"#ff0000\">".$this->errors[$field]."</font>";
      }else{
         return 
"";
      }
   }

   
/* getErrorArray - Returns the array of error messages */

   
function getErrorArray(){
      return 
$this->errors;
   }
};


?>

Please Please help me!!!!!!!!!!!!!!!!!!!!

Thank you in advance
Jens

Last edited by wirehopper; 03-20-10 at 09:02 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-20-10, 09:02 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Quote:
};
The semicolon at the end of the file should be removed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-20-10, 11:19 AM
jensende jensende is offline
New Member
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Wink

I did remove the semi colon but getting the same message!!!!

Please help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-20-10, 05:43 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
I give up.

Please post the entire error message, which probably includes the line number.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 03-24-10, 05:17 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
No syntax errors;

PHP Code:

<?php

class Form
{
   var 
$values = array();  //Holds submitted form field values
   
var $errors = array();  //Holds submitted form error messages
   
var $num_errors;   //The number of errors in submitted form

   /* Class constructor */

   
function Form(){

      
/**
       * Get form value and error arrays, used when there
       * is an error with a user-submitted form.
       */

      
if(isset($_SESSION['value_array']) && isset($_SESSION['error_array'])){
         
$this->values $_SESSION['value_array'];
         
$this->errors $_SESSION['error_array'];
         
$this->num_errors count($this->errors);

         unset(
$_SESSION['value_array']);
         unset(
$_SESSION['error_array']);
      }

      else{

         
$this->num_errors 0;

      }
   }


   
/**
    * setValue - Records the value typed into the given
    * form field by the user.
    */

   
function setValue($field$value){
      
$this->values[$field] = $value;
   }

   
/**
    * setError - Records new form error given the form
    * field name and the error message attached to it.
    */

   
function setError($field$errmsg){
      
$this->errors[$field] = $errmsg;
      
$this->num_errors count($this->errors);
   }

   
/**
    * value - Returns the value attached to the given
    * field, if none exists, the empty string is returned.
    */

   
function value($field){
      if(
array_key_exists($field,$this->values)){
         return 
htmlspecialchars(stripslashes($this->values[$field]));
      }else{
         return 
"";
      }
   }


   
/**
    * error - Returns the error message attached to the
    * given field, if none exists, the empty string is returned.
    */

   
function error($field){
      if(
array_key_exists($field,$this->errors)){
         return 
"<font size=\"2\" color=\"#ff0000\">".$this->errors[$field]."</font>";
      }else{
         return 
"";
      }
   }

   
/* getErrorArray - Returns the array of error messages */

   
function getErrorArray(){
      return 
$this->errors;
   }
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 08:38 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.