Jump to content

Recommended Posts

Hi

 

Been struggling to find a way to automatically go to the top of the page after the php contact form is executed, when the success message is displayed.

Probhlem I have is that the form is quite long and when it is filled in the success or failure message is not fully seen as it displays at the top.

 

Thanks

 

Code below:

 

<div class="row">
                        <div class="col-md-6">

                            <div class="offset-anchor" id="contact-sent"></div>

                            <?php
                            if (isset($arrResult)) {
                                if($arrResult['response'] == 'success') {
                                ?>
                                <div class="alert alert-success" id="contactSuccess">
                                    <strong>Success!</strong> Your message has been sent to us.
                                </div>
                                <?php
                                } else if($arrResult['response'] == 'error') {
                                ?>
                                <div class="alert alert-danger" id="contactError">
                                    <strong>Error!</strong> There was an error sending your message. (<?php echo $arrResult['error'];?>)
                                </div>
                                <?php
                                } else if($arrResult['response'] == 'captchaError') {
                                ?>
                                <div class="alert alert-danger" id="contactError">
                                    <strong>Error!</strong> Verificantion failed.
                                </div>
                                <?php
                                }
                            }
                            ?>

Link to comment
https://forums.phpfreaks.com/topic/301689-move-to-top-of-page-after-execution/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.