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 7720855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:46:28+00:00 2026-06-01T03:46:28+00:00

Can someone tell me what is wrong with my code? $c = ‘<div class=desc>’;

  • 0

Can someone tell me what is wrong with my code?

        $c =  '<div class="desc">';
    if( $_POST['login_post'] == '1') { 
    $username = $_POST['user_login'];
    $password = $_POST['password'];
        $message = log_in_user($username, $password);
    }
    display_message($message); 
    $c .= '<form name="loginform" id="loginform" method="post" action="">
                            <label>Username:</label>
                            <div><input type="text" name="user_login" id="user_username"  value="" size="20"  maxlength="40" tabindex="10" /></div>
                            </div>
                            <div class="group">
                            <label>Password:</label>
                            <div><input type="password" name="password" id="user_password"  value="" size="20"  maxlength="40" tabindex="20" /></div>
                            </div>
                             <input type="hidden" name="login_post" value="1"/>

                            <div class="group">
                            <label></label>
                            <div><input type="submit" name="submit" id="submit" class="bluebutton" value="Log In Now" /><span class="forgotlink"><a href="/forgot-password/">Forgot your password?</a></span></div>
                            </div> 
                </form>

                    </div>';
    $c = str_replace('%value%',5,$c);
    return $c;

That display_message($message); function is supposed to display the message inside the desc div. Instead, it is displaying above (outside) the desc div.

Am I concatenating PHP code incorrectly? If yes, can some one correct me? Thanks!

Update:

Here is my display_message function:

function display_message( $message = false ) {
    if( is_wp_error( $message ) ) {
        echo '<div class="errorMessage"><p>' . $message->get_error_message() . '</p></div>';    
    }
    elseif ($message != '') {
        echo '<div class="successMessage"><p>' . $message . '</p></div>';   
    }
}
  • 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-01T03:46:29+00:00Added an answer on June 1, 2026 at 3:46 am

    display_message() will print out the message instead of concatenating it. Try changing display_message($message); to $c .= htmlspecialchars($message); and it should end up inside the div as it is supposed to.

    Edit: Since display_message does more than just display the message, it needs to be rewritten slightly;

    function format_message( $message = false ) {
        if( is_wp_error( $message ) ) {
            return '<div class="errorMessage"><p>' . $message->get_error_message() . '</p></div>';    
        }
        elseif ($message != '') {
            return '<div class="successMessage"><p>' . $message . '</p></div>';   
        }
    }
    

    and the concatenation should instead be;

    $c .= format_message($message);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please tell me what's wrong with this code? Chrome and Firefox are
Please can someone really tell me what's wrong with this code that I'm having
Can someone tell me what's wrong with this code? I'm trying to upload a
Can someone tell me whats wrong with my code. I'm guessing that I didn't
Can someone tell me whats going wrong in this code! testit :- read(Term1), read(Term2),
Can someone tell me what's wrong with this code? I want to create a
Can someone please tell me what's wrong with this code? Basically what I am
can someone please tell me what I'm doing wrong in this code? if($id !=
Can someone tell me what is wrong with this code? <?php $user = $fgmembersite->UserFullName();
Can someone please tell me whats wrong with this code. I'm not getting complete

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.