beennn Posted July 20, 2011 Share Posted July 20, 2011 Is it possible to echo a html form?this is what im currently doing:<?echo("<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\"></form>");?>is there a way to, i don't know, reference it to a html form? for example:<?echo($html_form_name);?> Link to comment Share on other sites More sharing options...
justsomeguy Posted July 20, 2011 Share Posted July 20, 2011 $html_form_name = "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\"></form>";echo($html_form_name); Link to comment Share on other sites More sharing options...
beennn Posted July 20, 2011 Author Share Posted July 20, 2011 sorry, i mean is there a way to do:<html> <form id="name_of_html" name="form" method="post"> </form></html>turn it into a php var:$html_form_name = "name_of_html_form"then echo it like that >.<echo($html_form_name); Link to comment Share on other sites More sharing options...
brucemand Posted July 20, 2011 Share Posted July 20, 2011 sorry, i mean is there a way to do:<html> <form id="name_of_html" name="form" method="post"> </form></html>turn it into a php var:$html_form_name = "name_of_html_form"then echo it like that >.<echo($html_form_name);yes, i believe that's what JSG's example is actually doing. Link to comment Share on other sites More sharing options...
Ingolme Posted July 20, 2011 Share Posted July 20, 2011 Do you want the entire form in a variable or just the name?You don't necessarily have to echo everything, you may have portions of PHP in your HTML. <?php$html_form_name = 'something';?><form action="<?php echo $_SERVER['PHP_SELF']; ?>" id="<?php echo $html_form_name; ?>" method="POST"></form> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.