jwhite68 Posted June 27, 2007 Share Posted June 27, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/57384-php-generating-html/ Share on other sites More sharing options...
gerkintrigg Posted June 27, 2007 Share Posted June 27, 2007 you could use images as your submit buttons and then have the cancel image button as a normal HTML link (or even make it a dynamic link) but nothing to do with the form itself. that'd allow you to nest the cancel button inside the form. Quote Link to comment https://forums.phpfreaks.com/topic/57384-php-generating-html/#findComment-283881 Share on other sites More sharing options...
jwhite68 Posted June 27, 2007 Author Share Posted June 27, 2007 Could you provide any sample code to explain? Quote Link to comment https://forums.phpfreaks.com/topic/57384-php-generating-html/#findComment-283884 Share on other sites More sharing options...
jwhite68 Posted June 27, 2007 Author Share Posted June 27, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/57384-php-generating-html/#findComment-283982 Share on other sites More sharing options...
jwhite68 Posted June 27, 2007 Author Share Posted June 27, 2007 I just inserted the following between the images: <img src="elements/blank_space.gif"> Where blank_space.gif is a small white image, that creates the space. Quote Link to comment https://forums.phpfreaks.com/topic/57384-php-generating-html/#findComment-283997 Share on other sites More sharing options...
ToonMariner Posted June 27, 2007 Share Posted June 27, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/57384-php-generating-html/#findComment-284374 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.