Thomisback Posted March 10, 2008 Share Posted March 10, 2008 Hi, I am trying to echo a HTML form in PHP but I also need to echo PHP variables in the form, I have done it like this: echo ' <table width="300" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <form name="form1" method="post" action="registercheck.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1"> <tr> </tr> <tr> <td width="78">Gebruikersnaam:</td> <td width="6">:</td> <td width="294"><input name="usr" type="text" id="usr" value=<?php echo $userName;?> </td> <<< does not work </tr> <tr> <td>Wachtwoord</td> <td>:</td> <td><input name="pw" type="text" id="pw" value=$userPassword></td> <<< does not work either </tr> <td>E-mail adres:</td> <td>:</td> <td><input name="email" type="text" id="email" value=$userMail></td> <<< does not work either </tr> <td>Type:</td> <td>:</td> <td><input name="type" type="text" id="type" value=$type></td> <<< does not work either </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Meld aan!"></td> </tr> </table> </td> </form> </tr> </table> '; Link to comment https://forums.phpfreaks.com/topic/95374-php-echo-html-form/ Share on other sites More sharing options...
trq Posted March 10, 2008 Share Posted March 10, 2008 Your already within php so there no need for more <?php tags. however, variables are not interpolated within single quotes. You will need to come out of the quotes and concatinate your variables. eg; value=<?php echo $userName;?> </td> will become... value=' . $userName . '</td> Link to comment https://forums.phpfreaks.com/topic/95374-php-echo-html-form/#findComment-488434 Share on other sites More sharing options...
Thomisback Posted March 10, 2008 Author Share Posted March 10, 2008 Thanks a lot, that helped Link to comment https://forums.phpfreaks.com/topic/95374-php-echo-html-form/#findComment-488451 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.