Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9158757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:19:29+00:00 2026-06-17T13:19:29+00:00

Having issues positioning the alert message (You need to fill in all required fields!!,

  • 0

Having issues positioning the alert message (You need to fill in all required fields!!, etc) Cannot do it through CSS because the elements don’t have anywhere to take their positions from.

Any ideas?

    <!DOCTYPE html>
<html lang="en-US">
    <head>
    <meta charset="utf8" />

        <link rel="stylesheet" type="text/css" media="all" href="css/mainstyle.css"/>

        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script src="js/everypage.js"></script>

        <meta name="viewport" content="initial-scale=1" />
        <link rel="shortcut icon" href="IMG/tabicon/favicon.ico" >
        <title> A band </title>




<?php
        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        $from = 'From: Website'; 
        $to = 'info@example.com'; 
        $subject = 'Hello';
        $human = $_POST['human'];

        $body = "From: $name\n E-Mail: $email\n Message:\n $message";

        if ($_POST['submit']) {
        if ($name != '' && $email != '') {
            if ($human == '4') {                 
                if (mail ($to, $subject, $body, $from)) { 
                echo '<p class="alert">Your message has been sent!</p>';
            } else { 
                echo '<p class="alert">Something went wrong, go back and try again!</p>'; 
            } 
        } else if ($_POST['submit'] && $human != '4') {
            echo '<p class="alert">You answered the anti-spam question incorrectly!</p>';
        }
        } else {
            echo '<p class="alert">You need to fill in all required fields!!</p>';
        }
    }
    ?>

    </head>
    <body>
    <div id="background">
        <div id="wrapper">


            <div class="navigation">
                <ul id="mainmenu">
                    <li><a href="index.html">Home</a></li>  
                    <li><a href="band.html">Band</a></li>
                    <li><a href="news.html">News</a></li>
                    <li><a href="shows.html">Shows</a></li>
                    <li><a href="music.html">Music</a></li>
                    <li><a href="gallery.html">Gallery</a></li>
                    <li><a href="media.html">Media</a></li>
                    <li><a href="store.html">Store</a></li>                         
                </ul>
            </div>
            <div class="article">
                <div id="logo"></div>
                <div class="contacts">
                        <h1> Contact, booking:</h1>
                        <p> info@example.com </p>
                        <p> Tel: +372 58 131 054</p>
                </div>    


              <form method="post" action="contact.php">

                    <label>Name</label>
                    <input name="name" placeholder="Type Here">

                    <label>Email</label>
                    <input name="email" type="email" placeholder="Type Here">

                    <label>Message</label>
                    <textarea name="message" placeholder="Type Here"></textarea>

                    <input id="submit" name="submit" type="submit" value="Submit">

                    <label>*What is 2+2? (Anti-spam)</label>
                    <input name="human" placeholder="Type Here">   

            </form>

            </div>                     
            </div>

                <div class="footer contactfooter">
                    <p class="bandmembers">content</p>
                    <p class="signature">content</p>

                        <ul id="footermenu">
                            <li><a href="terms.html">Terms of use</a></li>
                            <li><a href="privacy.html">Privacy Policy</a></li>
                            <li><a href="contact.php">Contact</a></li>
                       </ul>

                </div>
          </div> 
    </div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:19:31+00:00Added an answer on June 17, 2026 at 1:19 pm

    You can position the alert <p> tags by wraping the relevant input(s) and using position:relative (to the wrapper element) to position the message element.

    So in your JavaScript validation:

    1. determine which form element should be the cue for placement of the message.
    2. Wrap the form element.
    3. append the alert to the wrapper.

    The validationWrapper class should avoid adding padding/margin to the destination elements. It should simply be a starting point for the placement of the alert-classed element.

    The following code makes use of the jQuery JavaScript library:

    $(formElem).wrap("<div class=\"validationWrapper\"></div>");
    $(".validationWrapper").append("<p class=\"alert\">"+message+"</p>");
    $(".validationWrapper .alert").css({ position: "relative", left: 0, top: "-5em"});
    

    Also, your form is straight out vulnerable to spammers. The To header should be set server-side. Nevermind, didn’t noticer the PHP tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I'm trying to get my positioning set up and I'm having some issues
Im having issues vertically positioning text inside of a text input field in Firefox.
I'm having issues aligning form elements the way I want using CSS. This is
So, I'm having an issue with CSS Positioning / Height So, I'm trying to
I'm having issues with .NET's UserPrincipal.GetGroups() method. On nearly all system in my domain
I am having an issue positioning a div that I've styled using CSS in
Having issues with Twitter Bootstrap responsive navigation. The best way to explain this is
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
Am having issues with printing different sized PDF's using GhostScript (V9.05). The PDF in
Still having issues with this problem. Please help if you can. So I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.