Page 1 of 1

repeating a form that is in a function.

Posted: Fri Feb 21, 2003 9:19 am
by deejay
hi

i have a form placed inide a function (i have got this form from a book). when displaying the function in the body of the page I have to use this code

<?php


cctvSignUp()


?>
<?php


}

?>

without the extra <?php } ?> it wont work. now my problem is calling up that function again in a echo statement like this.

die ('<tr>
<td align="left"><b><font class="errorMessage">'.$cctvSignUp.'</font></b></td>
</tr><BR>

');

but need to some how include
<?php


}

?>

but dont know how. any ideas ?

Thanks for anyhelp you may be able to give.

Posted: Fri Feb 21, 2003 12:30 pm
by BDKR
First off, the reason this doesn't work without the closing ?> is becuase there is no semi colon! Try it like this:

Code: Select all

<?php
cctvSignUp();
}
?>
This is something that a lot of people with more of a design bent do. Take a look at the default index page for the b2 blog ware as an example. Eventhough the php engine let's you get away with it, it's very bad practise and just leads to confusion.

As for the other issue, $cctvSignUp is not a function. It's a variable. Try replacing it with...

Code: Select all

<? cctvSignUp(); ?>
Cheers,
BDKR

_

Posted: Mon Feb 24, 2003 6:44 am
by deejay
thanks, i ahve located where the missing } is in the include so that solves that.

as for the function as a variable, i thought i read in the manual that i could get away with doing it that. what i am trying to is insert the function in a die tag. like this

die ('
<tr>
<td align=\"left\"><b><font class=\"errorMessage\">Error: Your passwords have not matched. Please enter them again.</font></b></td>
</tr> <BR>

'. THIS IS WHERE i WANT THE FUNCTION TO GO.'');



i have tried putting .cctvSignUp. or .cctvSignUp(). and .cctvSignUp();. . any ideas. :oops: i'm sure it'll be simple but cant find solution in the manual

Thanks

Deej

Posted: Mon Feb 24, 2003 9:21 am
by BDKR
This should work.

Code: Select all

die ('
<tr>
<td align="left"><b><font class="errorMessage">Error:  Your passwords have not matched. Please enter them again.</font></b></td>
</tr>  <BR>'. cctvSignUp());
You shouldn't need a '.' after the function call. Same goes for the semi-colon.

Cheers,
BDKR

_

Posted: Mon Feb 24, 2003 10:29 am
by deejay
thanks cant beleive i didn't try that. now the though the function displays at the top of page. So I have put the function in a table to see if that would help.

die ('
<link rel="stylesheet" href="../phpBB/templates/subSilver/subSilver.css" type="text/css">
<tr>
<td align="left"><b><font class="errorMessage">Error: Your passwords have not matched. Please enter them again.</font></b></td>
</tr> <tr>
<td align="left">'.cctvSignUp().'</td>
</tr>');

but still displays at the top. will consult the documentation for some idea why?

Thanks