adredz Posted December 1, 2009 Share Posted December 1, 2009 If I have the code below, how would I modify it? <div id="button_brief" alt="button_brief" onclick="location.href='http://localhost/form/';" style="cursor:pointer;"></div> can I do it like this? <div id="button_brief" alt="button_brief" onclick="location.href='http://localhost/form/';" style="cursor:pointer; <?php echo '<div>form here</div>"></div> I tried it but it won't may be I am missing something? pls help.. Quote Link to comment https://forums.phpfreaks.com/topic/183512-throw-a-form-and-redirect-to-another-page-how/ Share on other sites More sharing options...
mikesta707 Posted December 1, 2009 Share Posted December 1, 2009 <div id="button_brief" alt="button_brief" onclick="location.href='http://localhost/form/';" style="cursor:pointer;"> <?php echo form; ?> </div> ? I think i'm misunderstanding you, can you explain a little better Quote Link to comment https://forums.phpfreaks.com/topic/183512-throw-a-form-and-redirect-to-another-page-how/#findComment-968649 Share on other sites More sharing options...
adredz Posted December 1, 2009 Author Share Posted December 1, 2009 Say I have a button in my homepage and its placeholder is a <div> tag. HOw do I add an onclick attribute so when it gets clicked it would throw a mailer form and clear my homepage to give room for the mailer form... Quote Link to comment https://forums.phpfreaks.com/topic/183512-throw-a-form-and-redirect-to-another-page-how/#findComment-968664 Share on other sites More sharing options...
mikesta707 Posted December 1, 2009 Share Posted December 1, 2009 do you want to do this without reloading the page? if so you need javascript. It seems like you do want to do this as you mention the onclick attribute. You can call a javascript function that changes the innerHTML attribute of the div with your form. something like <script type="text/javascript" > function change() { div = document.getElementById('button_brief'); div.innerHTML = "your form here"; } </script> and call something like that in your onclick attribute. Quote Link to comment https://forums.phpfreaks.com/topic/183512-throw-a-form-and-redirect-to-another-page-how/#findComment-968672 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.