aolong Posted June 12, 2009 Share Posted June 12, 2009 When I use the following code, I'm getting two sets of $results echoed. If I remove the second hidden input, everything is fine. I can't seem to see my error and hope a fresh set of eyes and someone with more experience may shed some light on this. Pretty sure it's my quoting inside the second hidden input since $result is about 200 characters long and includes spaces and html code. An image is attached to show the buggy output. if (mail($to, $subject, $eMessage, $headers)) { echo "<div align='center'> <p><span style='font-style:italic;font-size:85%;'> Result summary successfully sent to [email protected].</span></p> <p><strong>Press the button below to re-authenticate the controller and apply your changes.</strong></p> <form action='./re-auth.php' method='post'> <input type='hidden' name='propertyIP' value=$propertyIP> <input type='hidden' name='results' value=$results> <input type='submit' value='Apply Changes'> <p><span style='font-style:italic;font-size:85%;'>debug: value to be submitted is $propertyIP.</span></p> </form> </div>"; } else { echo "<br />Summary email could not be sent, please report to [email protected]"; } [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/161958-solved-proper-quoting-to-pass-variable-inside-echo-statement/ Share on other sites More sharing options...
cunoodle2 Posted June 12, 2009 Share Posted June 12, 2009 Since you don't have single quotes around those fields html will parse them as being the end of the value as soon as a space happens. Try this.. <input type='hidden' name='propertyIP' value='$propertyIP'> <input type='hidden' name='results' value='$results'> if that does not work then try this.. <input type='hidden' name='propertyIP' value=\"$propertyIP\"> <input type='hidden' name='results' value=\"$results\"> Link to comment https://forums.phpfreaks.com/topic/161958-solved-proper-quoting-to-pass-variable-inside-echo-statement/#findComment-854554 Share on other sites More sharing options...
aolong Posted June 12, 2009 Author Share Posted June 12, 2009 your second suggestion does the trick. thanks you! Link to comment https://forums.phpfreaks.com/topic/161958-solved-proper-quoting-to-pass-variable-inside-echo-statement/#findComment-854556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.