Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Re: Can you Find my syntax error expecting ',' or ';' please

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Re: Can you Find my syntax error expecting ',' or ';' please

Postby ak4744710 » Mon Feb 11, 2013 12:40 am

This is driving me crazy trying to figure out what I am doing wrong with this form I am guessing something is not closing correctly but i have no clue what I have submitted my code below if anyone can please help! Also before anyone says I am forgeting the closing tags on 5 and 6 test it and see it will not work even with the semi coluns thats what has me so stumped.
Code: Select all
<?php
function printForm($strMessage){
echo "<strong>" .$strMessage."</strong>";
echo "<form method=\"post\" action=\"" .$_SERVER['PHP_SELF']. "\" name=\"form\">\n";
echo "First Name: <input type=\"text\" name=\"fname\" value=\"" .trim($_POST['fname'])."\"
echo  "Last Name: <input type=\"text\" name=\"lname\" value=\"" .trim($_POST['lname'])."\"
echo "<input type=\submit\" value=\"send\" name=\"submit\"/>\n";
echo "</form>\n";
}
?>
<html>
<head>
<title>Self Submitting Sticky Form</title>
</head>
<body>
    <?php
    if(isset($_POST['submit'])){
    $firstname=trim($_POST['fname']);
    $lastname=trim($_POST['lname']);
    if ($firstname==''){
    $strMessage='Please enter your first name.';
    printForm($strMessage);
    }
    elseif ($lastname==''){
             $strMessage='Please enter your last name.';
             printForm($strMessage);
    }
    else{
    $strMessage='Thank you. your information was sent.';
    echo $strMessage;
    }
}
else{
$strMessage='Please enter all fields below:';
printForm($strMessage);
}
?>
</body>
</html>
ak4744710
New php-forum User
New php-forum User
 
Posts: 4
Joined: Fri Feb 08, 2013 11:29 pm

Re: Can you Find my syntax error expecting ',' or ';' please

Postby ak4744710 » Mon Feb 11, 2013 1:07 am

solved thanks for everyone's help
ak4744710
New php-forum User
New php-forum User
 
Posts: 4
Joined: Fri Feb 08, 2013 11:29 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 5 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron