Jump to content

Help needed please


westminster

Recommended Posts

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?
Link to comment
https://forums.phpfreaks.com/topic/8929-help-needed-please/
Share on other sites

hi, thanks for you help. i added the php tags but now it comes up with the following error

Parse error: syntax error, unexpected ';', expecting ')' in C:\wamp\www\Westminster_Studentville\NewMember.php on line 24

what 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.
Link to comment
https://forums.phpfreaks.com/topic/8929-help-needed-please/#findComment-32822
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.