Jump to content

echo a html form?


beennn

Recommended Posts

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...