Jump to content

Archived

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

westminster

Help needed please

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
try changing [code] $err ,= "Please fill in your $label" <br>";[/code] to [code] $err .= "Please fill in your $label" <br>";[/code]

Share this post


Link to post
Share on other sites

×

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.