PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
zeroanarchy
Forum Newbie
Posts: 15 Joined: Wed Jul 21, 2004 8:51 pm
Post
by zeroanarchy » Tue Aug 03, 2004 12:51 am
Ok well have been looking at code on here for a bit and cannot seem to find an example of
Code: Select all
<form action ="sent.php">
<input type="submit" value="Send Letter">
being used inside of PHP. I have an if statement and if the statement is true I want it to add the above button to the page if not don't display it.
I tried
Code: Select all
echo "<form action ="sent.php">";
echo "<input type="submit" value="Send Letter">";
but just kept getting errors, any ideas?
Thanks in advance.
zeroanarchy
g3ckO
Forum Contributor
Posts: 117 Joined: Mon Jul 12, 2004 2:57 am
Location: Malaysia
Contact:
Post
by g3ckO » Tue Aug 03, 2004 1:07 am
I think you don't have to put the "echo". Just simply type the code without echo.
fresh
Forum Contributor
Posts: 259 Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika
Post
by fresh » Tue Aug 03, 2004 1:12 am
you can echo it too, but make sure you dont use double quotes inside of double quotes..
ex.
echo "<input type='submit' name='sub' value='Submit'>";
hope that helps
Revan
Forum Commoner
Posts: 83 Joined: Fri Jul 02, 2004 12:37 am
Location: New Mexico, USA
Contact:
Post
by Revan » Tue Aug 03, 2004 4:26 am
or
echo "<form action =\"sent.php\">
<input type="submit" value=\"Send Letter\">"
echo "<input type="\submit\" value=\"Send Letter\"> "
kettle_drum
DevNet Resident
Posts: 1150 Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England
Post
by kettle_drum » Tue Aug 03, 2004 5:16 am
Pretty sure you need to use double quotes to be w3 complient as well. But theres no need to use two echo's, just have it all in one:
Code: Select all
echo "
this
and this
and maybe something here too.
";
fresh
Forum Contributor
Posts: 259 Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika
Post
by fresh » Tue Aug 03, 2004 5:59 am
yeah, but not inside another double quote, because you will neutral out the main dbl quotes, BTW... I usually echo the whole thing too, if needed of course, which in this case is not..
zeroanarchy
Forum Newbie
Posts: 15 Joined: Wed Jul 21, 2004 8:51 pm
Post
by zeroanarchy » Tue Aug 03, 2004 8:24 am
Thanks all for your help, something I should have remembered from my VB coding days.
Cheers
zeroanarchy
JAM
DevNet Resident
Posts: 2101 Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:
Post
by JAM » Tue Aug 03, 2004 8:38 am
Revan wrote:
<input type="submit" value="Send Letter">"
(You forgot the \ & ; at the "submit" btw)
Another approach...
Code: Select all
echo '
<form action="sent.php">
<input type="submit" value="Send Letter">
';
echo '<input type="submit" value="Send Letter">';...using single quotes around strings or the
Heredoc syntax...
The ongoing discussion about what's best...