vijdev Posted November 2, 2010 Share Posted November 2, 2010 can i use iframe to display a php form, and when it is submitted, only the iframe portion has to fetch the new thank you page, and the overall page is not refreshed. is this a good idea? Quote Link to comment Share on other sites More sharing options...
nano Posted November 2, 2010 Share Posted November 2, 2010 I wouldn't think there is a need for use of an iframe. What you could do is a mixture of JS/jQuery and PHP. When user submits form, the form is then hidden and a container which houses a Thank You message is then shown. http://www.raymondselda.com/php-contact-form-with-jquery-validation/ The above is a nice tutorial and basically in this bit: <?php if(isset($emailSent) && $emailSent == true) { ?> <?php } ?> You could put JavaScript to trigger a function that hides the form and shows your message Try and stay away from iframes, they are horrible things! Quote Link to comment Share on other sites More sharing options...
vijdev Posted November 3, 2010 Author Share Posted November 3, 2010 the thing is am still a sub-novice at jquery or any ajaxy things.. so was wondering abt iframes... i know ajax is the ultimate final destination. any alternatives until then?..why do you say NO to iframes?..is it so dangerous and messy? and if not ajax and if not iframes..anything else? Quote Link to comment Share on other sites More sharing options...
nano Posted November 3, 2010 Share Posted November 3, 2010 No AJAX is required and nor are iFrames. Basically you have a hidden container div, that contains your thank you message. When user posts the form, the mail is sent etc, then you simply Hide your form with jQuery/JavaScript and then show the thank you div. Have a look at the link I posted above, it should give you a good understanding. Quote Link to comment Share on other sites More sharing options...
A1SURF.us Posted November 3, 2010 Share Posted November 3, 2010 Using frames is not secure. Why don't you just change the .HTML page extension to .PHP and combine the form into the current page by simply embedding the PHP code or give it the same style sheet as the rest of your site and designate the form as a separate page. You can even include the form with PHP if you change the page extension from .HTML to . PHP, then just include an echo in the bottom of the PHP form: <?PHP include('your-form-page.php'); echo 'Thanks for using this form!'; ?> Keep in mind that most people don't have a 1400x1200 wide screen resolution when they browse the Internet thanks to phones and hand-held devices that can browse the internet, so you want to keep forms on separate pages anyway. Quote Link to comment 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.