Re: re: some problems with php form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike and all,
 guess I still have something wrong as I am getting this error:
 *Parse error*: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING in *
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form.php<http://evolution.com/Contact_Form.php>
* on line *52*
  line 52 is:
 <input class="<?PHP
if ($error_msg) {echo "error"}
else {echo "normal"}
?>" id="firstname" name="firstname" type="text" value="<?php
echo $_POST['firstname'] ?>">
  how would I fix this error?

 On 10/18/05, Ford, Mike <M.Ford@xxxxxxxxxxxxxx> wrote:
>
> On 18 October 2005 15:50, Bruce Gilbert wrote:
>
> > I think so Minuk. Here is the *entire* form code below. Maybe
> > someone can
> > also point out why the email regex validation code isn't working? TIA
> > /****************************begin PHP form
> > code*************************************/
> >
> > <?php
> > $form_block=<<<END_FORM
>
> Here starteth a heredoc ;)
>
> > <form method="post" action="{$_SERVER['PHP_SELF']}"
> > class="info_request" > <fieldset class="left">
> > <legend title="About You">About You</legend>
> >
> > <p><label for="firstname"><span class="red">*</span> First
> > Name: </label><br
> > />
> >
> > <input class="<?PHP if ($error_msg){echo "input.error";}else{echo "
>
> Here you try to start a block of PHP code within the heredoc. You can't do
> that.
>
> Because you didn't show us the heredoc, most of the responses assumed you
> had broken out of PHP completely into HTML, which is why many of the
> solutions produced parse errors.
>
> > input.normal";}?>" id="firstname" name="firstname"
> > type="text" value="<?PHP
> > echo $_POST['firstname'];?>">
>
> Again, you're trying to use PHP code inside a heredoc -- this one's
> solvable, though: as you just want the value of the variable, you can use
> {$_POST['firstname']} (which I notice you do elsewhere!).
>
> Actually, since you use the heredoc's value once almost immediately after
> assigning it, I think you probably would be better breaking out into PHP for
> most of this, thusly:
>
> if ($_POST['op']!='ds') {
>
> ?>
> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"
> class="info_request" >
> <fieldset class="left">
> <legend title="About You">About You</legend>
>
> <p><label for="firstname"><span class="red">*</span> First Name:
> </label><br />
>
> <input class="<?PHP
> if ($error_msg) {echo "error"}
> else {echo "normal"}
> ?>" id="firstname" name="firstname" type="text" value="<?php
> echo $_POST['firstname'] ?>">
>
> ... etc. ...
>
> <?php
> } else if ($_POST["op"] == "ds") {
>
> Hope this helps.
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Headingley Campus, LEEDS, LS6 3QS, United Kingdom
> Email: m.ford@xxxxxxxxxxxxxx
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
>
>
> To view the terms under which this email is distributed, please go to
> http://disclaimer.leedsmet.ac.uk/email.htm
>



--
::Bruce::

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux