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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:39:19+00:00 2026-05-25T09:39:19+00:00

<?php echo ‘<form action=’; echo $_SERVER[‘PHP_SELF’]; echo ‘ method=post><input class=loginDropdownInput type=text name=user value=’; if(isset($_COOKIE[‘rememeredusername’])==’true’){

  • 0
<?php
echo '<form action="';
echo $_SERVER['PHP_SELF']; 
echo '" method="post"><input class="loginDropdownInput" type="text" name="user" value=';
if(isset($_COOKIE['rememeredusername'])=='true'){
  echo $_COOKIE['rememeredusername'];
} else {
  echo 'Username';
}
echo 'onclick="if(this.value == "Username") this.value="";" onblur="if(this.value.length == 0) this.value="" Username""; /></br></br><input class="loginDropdownInput" type="password" name="pass" value="Password" onclick="if(this.value == "Password"") this.value="";"  onblur="if(this.value.length == 0) this.value="Password";"/>
?>

<span>
  </br>
  </br>
  <span class="rememberMe">Remember me</span>
  <input class="rememberMeBox" value="rememberme" name="rememberme" type="checkbox"/>
</span>

<a class="forgotPassword" href="../Accounts/forgot.php">Forgot your password?</a>

<?php
echo '<p class="loginErrorMessage">';
if ($userexists=='false'){
  echo "Uh oh, try again...";
}  
echo'</p><input class="submitDropdownInput" type="image" src="../Images/submitDropdownInput.png" alt="Login"/></form>';
?>

This is my code for a login portion of my site. However, input.loginDropdownInput keeps coming out with a value of “Usernameonclick=”if(this.value” instead of “Username”.
Where is my syntax error?

  • 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-05-25T09:39:20+00:00Added an answer on May 25, 2026 at 9:39 am

    I don’t know what exactly are your needs, but I would seriously recommend you to stop mixing so much PHP and markup like you’re doing right now, it’s horrible to read and almost impossible to maintain.

    Try doing something like:

    PHP part:

    if (isset($_COOKIE['rememeredusername'])){ 
      $form['username'] = $_COOKIE['rememeredusername'];
    } else {
      $form['username'] = "Username";
    }
    $form['username'] = htmlspecialchars($form['username']);
    

    HTML part:

    <form action="" method="post">
    <input class="loginDropdownInput" type="text" name="user" value="<?=$form['username']?>"
      onfocus="if(this.value == 'Username') this.value='';"  
      onblur="if(this.value.length == 0) this.value='Username';" />
    

    Also you were using the onclick event, when you actually want it to be onfocus.

    That’s what I could understand from your code, try to make your php reproduce something like this if this is what you need.

    — Fixed some code errors.

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

Sidebar

Related Questions

index.php: <form action=post.php method=POST> <input type=text name=option_<?php echo $i ?> value= /> <input type=submit
I have a form in index.php <?php echo '<form action=update_act.php method=POST>'; echo '<input type=submit
Original Form <?php echo '<td><form action=episodesdelete.php method=POST>'; echo '<input type=hidden name=epid value='.$row['epid'].'>'; ?> episodesdelete.php
In PHP, it is possible to do this: <input type=text value= <?php echo Hello
The below code is in PHP echo <input type='submit' name='delete' value='$t2[0]' class='delete_button' onclick='return confirm('Please
How do I achieve this: //view.php <input type=hidden name=Name value=<?php echo $variable->id; ?> using
<?php echo <script type = 'text/javascript'></script>; ?> output's page source shows this : <script
I have the following link: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' => 'portfolio', 'action' => 'view',
i have this code : <?php echo $_POST['id-input']; $time = time(); $ip=$_SERVER['REMOTE_ADDR']; $userid_c =
How do I echo a forwardslash / ? echo <?php echo $_SERVER['HTTP_HOST'] ?> .

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.