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.
repeating a form that is in a function.
Moderator: General Moderators
First off, the reason this doesn't work without the closing ?> is becuase there is no semi colon! Try it like this:
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...
Cheers,
BDKR
Code: Select all
<?php
cctvSignUp();
}
?>As for the other issue, $cctvSignUp is not a function. It's a variable. Try replacing it with...
Code: Select all
<? cctvSignUp(); ?>BDKR
_
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.
i'm sure it'll be simple but cant find solution in the manual
Thanks
Deej
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.
Thanks
Deej
This should work.
You shouldn't need a '.' after the function call. Same goes for the semi-colon.
Cheers,
BDKR
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());Cheers,
BDKR
_
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
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