Jump to content

Function name must be a string?


lostprophetpunk

Recommended Posts

When processing a form I have created, I get the following error...

 

Fatal error: Function name must be a string in C:\xampp\htdocs\new\contact.php on line 83

 

What would I need to do to fix this? The relevant PHP code is below...

if(!$_POST['contact'])
{
//form html removed
}
else {
    //process form
    
    function cleanl($a) {
            $b = trim($a);
            $c = htmlentities($b);
            return $c;
    }
    
    $name = cleanl( $_POST['name'] );
    $email = cleanl( $_POST['email'] );
    $message = nl2br( cleanl( $_POST['message'] ) );
    $code = cleanl( $_POST['code'] );
    
    if($empty($name)){
            $a = 1;
    }else { $a = 0; }
    
    if($empty($email)){
            $b = 1;
    }else { $b = 0; }
    
    if($empty($message)){
            $c = 1;
    }else { $c = 0; }
    
    if($empty($code)){
            $d = 1;
    }else { $d = 0; }
    
    if($a == 1 || $b == 1 || $c == 1 || $d == 1){
            $error = "The form has not been filled in correctly. Please make sure you have done the following things...<br /><br />- Filled in all of the fields<br />- Enter a valid email address<br />- Answered the security question correctly.";
//form html removed
    }
    else {
            // film filled out, check it...
            if(validate_email($email)) { $pass = 0; } else { $pass = 1; }
            if($code == 4) { $assess = 0; } else { $assess = 1; }
            if($pass == 1 || $assess == 1) {
                    $error = "The form has not been filled in correctly. Please make sure you have done the following things...<br /><br />- Filled in all of the fields<br />- Enter a valid email address<br />- Answered the security question correctly.";
//form html removed
            }
            else {
                    //form passes, send form...
                    
            }
            
    }
    
}

 

If anyone could helo me out, thanks in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.