westminster Posted May 3, 2006 Share Posted May 3, 2006 Hi someone ple help me im new to php One problem i've got is that i created a form and added an error form called 'NewMember.php' such that if the user submits the form without filling it should send an error message telling them the part of the form that has been left blank. However, it doesnt like this, on cliking the submit button the page displays the whole php code. can someone tell me whats wrong, this's my code:--></style></head>$required = array("FirstName" => "First Name", "LastName" => "Last Name", "Email" => "Email Address", "Password" => "Password", "SecurityQuestion" => "Security Question";foreach($required as $field => $label) {if (!$_POST[$field]) { $err ,= "Please fill in your $label" <br>"; }}</body></html>on clicking the submit button this is what i get shown on the page below:$required = array("FirstName" => "First Name", "LastName" => "Last Name", "Email" => "Email Address", "Password" => "Password", "SecurityQuestion" => "Security Question"; foreach($required as $field => $label) { if (!$_POST[$field]) { $err ,= "Please fill in your $label" "; } } PLS HELP! WHATS WRONG? Quote Link to comment Share on other sites More sharing options...
ichversuchte Posted May 3, 2006 Share Posted May 3, 2006 trying adding the this [code] <?php ..... ?> [/code] around the code and your code shouldn't be shown like it has been.and does westminster stand for westminster college in pa Quote Link to comment Share on other sites More sharing options...
westminster Posted May 3, 2006 Author Share Posted May 3, 2006 hi, thanks for you help. i added the php tags but now it comes up with the following errorParse error: syntax error, unexpected ';', expecting ')' in C:\wamp\www\Westminster_Studentville\NewMember.php on line 24what should i do? and you mentioned my code is appearing the way it should.can u tell me how it is supposed to appear???by the by when you say westminster coll in pa, do you mean pa as in pennsylvania, usa? if so, no it's actually westminster university, london. Quote Link to comment Share on other sites More sharing options...
.josh Posted May 3, 2006 Share Posted May 3, 2006 umm.. what should you do? if you are asking questions like this, then you should go and pick up a php tutorial book or go to a tutorial site for the basic concepts and syntax of scripting with php. You know, the type that teaches you your first "hello world" program. Quote Link to comment Share on other sites More sharing options...
bradcis Posted May 3, 2006 Share Posted May 3, 2006 try changing [code] $err ,= "Please fill in your $label" <br>";[/code] to [code] $err .= "Please fill in your $label" <br>";[/code] Quote Link to comment Share on other sites More sharing options...
westminster Posted May 3, 2006 Author Share Posted May 3, 2006 hi thanks bradcis, yeah i figured out the problem already. thanks for replying anyways. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.