hi there i'm currently trying to create a form for a site and this has been done succesfully however on sending the form it goes to a new page saying either "Thanks! Our Team will get in touch in next 24 hours" or "Oops! something went wrong, please try to submit later."

what i want it to do instead is give the same messages but in a pop up box (dimensions 300px (w) x 200px (h)) that allows the user to then click ok and stay on the same page.

this is the HTML form coding;

 <form id="contact_form" method="post" action="contact.php" >
                            <div class="span6">
                                <label>First Name</label>
                                <input type="text" class="span6" id="name" name="first_name">
                            </div>
                            <div class="span6">
                                <label>Surname</label>
                                <input type="text" class="span6" id="name" name="last_name">
                            </div>
                            <div class="span6">
                                <label>telephone</label>
                                <input type="text" class="span6" id="telephone" name="telephone">
                            </div>
                            <div class="span6">
                                <label>Email</label>
                                <input type="text" class="span6" id="email" name="email">
                            </div>

                            <div class="span12">
                                <label>Message</label>
                                <textarea class="span12" id="comment" name="comment"></textarea>
                            </div>
                            <div class="span12">
                                <button type="submit" class="btn send-btn">Send <i class="icon-ok-sign"></i></button>
                            </div>
                        </form>

and this is the PHP echo coding

if(!empty($from_first_name) && !empty($from_last_name) && !empty($from_email) && !empty($message) && !empty($telephone))
{
    mail(DEST_EMAIL, SUBJECT_EMAIL, $message, $headers);
    echo SUCCESS_MESSAGE;
}
else
{
    echo ERROR_MESSAGE;
}

I apologise if this is something obvious i am an extreme beginner with the PHP coding however and despite looking at this all day would really appreciate any help any one can offer.

Thankyou

Recommended Answers

All 2 Replies

additionally if there is anything else that would help in shedding light on this issue please let me know. At the moment i am also still trying to find the best thing to search for to try and further my knowledge of this area. thanks

Your php is correct if job is done. However, that you are wanting is not PHP,
but JS (eventually HTML/CSS).
If you don't use twitter bootstrap or similar HTML/CSS framework, you can just
take a look on their modal window to be sure what code to use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.