Search the Community
Showing results for tags 'php htmlentities()'.
-
Hello all, I have problem about quoting texts using variable in the input tag of a form mail... Please allow me to quote my script first: <!-- File "00_test_htmldecode2.php" --> <center style="width:60%; margin:60px; padding:12px; border:solid 1px #bfbfbf;"> <?php //DEFINE VARIABLES HERE $packname = 'Beijing 10 days tour'; $packcontents = '<b>(1)</b> Direct flight to Beijing by "Boeing 747". <b>(2)</b> 3 nights at Beijing Hotel <a href="http://www.beijinghotel.cmm/" target="_blank">http://www.beijinghotel.cmm</a>.'; $packprice = 2000; $packdate = 'June 15, 2012'; ?> <table cellpadding="0" cellspacing="0" border="0" style="margin:12px;"> <form name="form" method="POST" action="/00_test_htmldecode.php"> <input type="hidden" name="pageid" value="page11"> <input type="hidden" name="packname" value="<?php echo $packname; ?>"> <input type="hidden" name="packcontents" value="<?php echo $packcontents; ?>"> <input type="hidden" name="packprice" value="<?php echo $packprice; ?>"> <input type="hidden" name="packdate" value="<?php echo $packdate; ?>"> <tr> <td align="center" valign="middle" style="padding:8px;"> <input type="submit" name="submit" value=" Click to Launch the Order Entry Form "> </td> </tr> </form> </table> </center> END QUOTE From the above code I was supposed to see only a "submit button" in an enclosed square. However, the following texts were also, but unexpectedly, displayed before the button (copied from the screen): (2) 3 nights at Beijing Hotel http://www.beijinghotel.cmm."> After some review I believe the problem is from the input tag of: <input type="hidden" name="packcontents" value="<?php echo $packcontents; ?>"> Also as a matter of fact, when the above form was submitted to a new page, only texts "(1) Direct flight to Beijing by" were displayed. My guess is that when the variable "$packcontents" was printed to the value of the input tag, the quotes in the contents of the variable have caused problems in the html rendering. Could anyone please show me how to echo a variable in the input tag that could avoid the above problems? Thanks, Cofa 1/9/2012