Re: Newbie ' If Statement' Question

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

 



On Fri, Mar 14, 2008 at 7:56 PM, cool7@xxxxxxxxxxxxxxxx <
cool7@xxxxxxxxxxxxxxxx> wrote:

> Hello Folks,
>
> I would like to be able to wrap a 'form' inside a php 'if statement' -  so
> that the form will appear if the 'if condition' is met.
>
> -  most likely I cannot have a <?php tag inside another one - and am sure
> I'm doing other things wrong also...
> - now I get the error - Parse error: syntax error, unexpected T_STRING
> in...
>
> Q:  What is the best way to accomplish this goal?
>
> -----------------------
>
> <?php if ($emp_row->getField('testfield') !="") {
>    print "<form name="edit" method="post" action="emp_edit_result2.php">
> <input type="hidden" name="Status" value="Active"/>
> <input type="hidden" name="The_Date" value=""/>
> <input type="hidden" name="-recid" value="<?php echo
> $emp_row->getRecordId(); ?>">
> <input type="submit" name="edit_submit" value="Activate">
> </form>
>
> ";}else {print "Non Print";} ?>
>

something like this,

<?php if($emp_row->getField('testfield') != '') { ?>
<form name="edit" method="post" action="emp_edit_result2.php">
  <input type="hidden" name="Status" value="Active" />
  <input type="hidden" name="The_Date" value="" />
  <input type="hidden" name="-recid" value="<?php echo
$emp_row->getRecordId(); ?> />
  <input type="submit" name="edit_submit" value="Activate" />
</form>
<?php } ?>

// warning: typed directly into browser w/ no testing ;)

-nathan

[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