Jump to content


Photo

Help needed please


  • Please log in to reply
5 replies to this topic

#1 westminster

westminster
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 03 May 2006 - 12:47 AM

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?

#2 ichversuchte

ichversuchte
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 03 May 2006 - 12:52 AM

trying adding the this
<?php .....  ?>
around the code and your code shouldn't be shown like it has been.


and does westminster stand for westminster college in pa

#3 westminster

westminster
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 03 May 2006 - 01:11 AM

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.

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 03 May 2006 - 01:19 AM

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.


Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 bradcis

bradcis
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 03 May 2006 - 02:16 AM

try changing
$err ,= "Please fill in your $label" <br>";
to
$err .= "Please fill in your $label" <br>";


#6 westminster

westminster
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 03 May 2006 - 03:49 AM

hi thanks bradcis, yeah i figured out the problem already. thanks for replying anyways.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users