Jump to content

PHP generating HTML


jwhite68

Recommended Posts

I have a PHP script which generates some HTML code for a simple form.

 

$resulturl= $bo_submit_url;

$epform .= '<form action="'.$resulturl.'" method="post">';  
$epform .= '<input type="image" src="elements/submit.gif" style="width:168px" />';  
$epform .= '</form>';

 

So it builds up $epform which is later output in another PHP file.

 

The form itself just has a 'submit' button on it, and pressing it send the output to the url defined in $resulturl.

 

Now, all I want to do is create the code that will add an additional 'cancel' button - but pressing the cancel button should just take control either (a) to a different URL specified in another variable, or preferably (b) take the user back to the previous page (before the one that generates $epform.

 

Any help appreciated.

Link to comment
https://forums.phpfreaks.com/topic/57384-php-generating-html/
Share on other sites

I managed to get my cancel button, by implementing the form like this:

 

<form action="test.php" method="post">
<input type="image" src="elements/submit.gif" style="width:168px" />'
<A HREF="www.abc.com" ><IMG SRC="elements/cancel.gif" BORDER="0"></A>
</form>

 

So the cancel button is effectively working as a link, which happens to have an image representing it. This works fine - but I have one slight cosmetic issue.

 

The 2 buttons above appear literally side by side with no space.  Whats easiest way of introducing a small space between these 2 'buttons' in HTML?

Link to comment
https://forums.phpfreaks.com/topic/57384-php-generating-html/#findComment-283982
Share on other sites

This may be a little more than you asked for but you should try to avoid using spacer html elements.  they add to the file size and hence the bandwidth used and hence the page loading time.  css can perform all teh spacing you need with the margin property.

 

A back 'button' shoudl simply be a link. You can again use cs to style both a normal submit button (image inputs behave differently on different browsers) and a link to look like one anther on most browsers.

 

I promise if you stick to smeantic html and leave the rest to style you will have a faster loading, more managable web site.

Link to comment
https://forums.phpfreaks.com/topic/57384-php-generating-html/#findComment-284374
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.