TwiztedCupid Posted July 22, 2007 Share Posted July 22, 2007 Hello. I was trying to figure out how to get a "Thank you" type message to appear on the same page as the form, after a user clicks submit. Right now when form is submitted it returns back to same page. I'm using Dreamweaver and Adobe Developer Toolbox, formerly known as MX Kollection. (Yeah I know this is cheating, but I'm a newb and it's way beyond easy for me to use). Here is my form code. <?php echo $tNGs->getErrorMsg(); ?> <form method="post" id="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>"> <table cellpadding="2" cellspacing="0" class="KT_tngtable"> <tr> <td class="KT_th"><label for="name">Name:</label></td> <td><input name="name" type="text" class="myform" id="name" value="<?php echo KT_escapeAttribute($row_rscomments['name']); ?>" size="32" /> <?php echo $tNGs->displayFieldError("comments", "name"); ?> </td> </tr> <tr> <td class="KT_th"><label for="email">Email:</label></td> <td><input name="email" type="text" class="myform" id="email" value="<?php echo KT_escapeAttribute($row_rscomments['email']); ?>" size="32" /> <?php echo $tNGs->displayFieldError("comments", "email"); ?> </td> </tr> <tr> <td class="KT_th"><label for="comments">Comments:</label></td> <td><textarea name="comments" cols="50" rows="5" class="myform" id="comments" style="height:100px"><?php echo KT_escapeAttribute($row_rscomments['comments']); ?></textarea> <?php echo $tNGs->displayFieldError("comments", "comments"); ?> </td> </tr> <tr> <td colspan="2"><input name="Reset" type="reset" class="button" id="button" value="Reset" style="margin-left:130px; margin-right:30px"> <input name="KT_Insert1" type="submit" class="button" id="KT_Insert1" value="Submit" style=""></td> </tr> </table> </form> I read somewhere that you can add a hidden field with a value of "contactus.php?submitted", and then call it with a function, or something? I'm guessing I would have to do some kind of "if url=contactus.php?submitted - echo thank you - else do nothing". But I'm not sure how to integrate this as easily as possible and not have to mess with the MX kollection's code. Any help would be appreciated. Thanks in advance. P.S. If it wasn't for us newbs you experts wouldn't have anything to laugh at. Link to comment https://forums.phpfreaks.com/topic/61219-thank-you-and-form-on-same-page/ Share on other sites More sharing options...
AndyB Posted July 22, 2007 Share Posted July 22, 2007 Typically, like this: if the form has been submitted, then check to see if all inputs are valid if the form has been submitted and inputs are valid then show "thank you" and end otherwise show error messages (if any) and show the form again Link to comment https://forums.phpfreaks.com/topic/61219-thank-you-and-form-on-same-page/#findComment-304580 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.