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: [EMAIL PROTECTED]
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to