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

  • Home
  • SEARCH
  • 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 9109631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:05:27+00:00 2026-06-17T03:05:27+00:00

I have the following form in my index.php page <form action=’login.php’ method=’POST’> Log in

  • 0

I have the following form in my index.php page

    <form action='login.php' method='POST'>
    Log in Here:<br><br>
    Username:<input type='text' name='User_name' value='username' onFocus="clearText(this)" id='fn'>
    <br><br>
    Password:<input type='password' name='_password' ><br><br>
    <input  value='Log in' type="image" src="client-login-buttonclient-login-button.jpg" ><br><br>
    <input type="checkbox" name="checkbox"  id="checkbox" />
    Remember password</span></p>
    </form>

and I am posting the form fields to another php page called login.php

  <?php

    session_start();
    $username=$_POST['User_name'];
    $password=$_POST['_password'];
    if($username && $password){
    echo $username;
    echo $password;
    }
    else {
    echo 'A field is empty';
    }

But when I do this, it gives me the following error

 Notice: Undefined index: User_name in login.php on line 4
 Notice: Undefined index: _password in login.php on line 5

Why is the post method not working?

  • 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-17T03:05:28+00:00Added an answer on June 17, 2026 at 3:05 am

    The error indicates that the variables are not being passed. In order to bypass the error and still catch that a field is blank, utilize isset():

    $username = (isset($_POST['User_name']) ? $_POST['User_name'] : '');
    

    This will check to see if the variable was passed and if so, then set the corresponding variable to that value, otherwise set it as ” (or another value of your choosing).

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

Sidebar

Related Questions

I have the following code: index.jsp: <form name=f action=db/ajoutConducteur.jsp method=post> <input type=text pattern=\d{8} required
I have the following form <form name=myForm id=myForm method=post enctype=multipart/form-data action=script.php> and this jQuery
I have the following form that has 2 selects: <form id=form class=form_visitar method=post action=ajax/selects.php>
in the form action i have the following line\ <form action={URL} method=post target=_self id=xxx
I have the follwing code <form enctype="multipart/form-data" action="upload.php" method="POST"> Please choose a file: <input
I have the following code in my main index.php: <div class=form> <?php $oForm =
I have a login form at the following page: site.com/en/downloads en is the user_language
I have the following code in a page (index.php), it's composed by just two
I have the following form: @model Teesa.Models.SearchModel @using (Html.BeginForm(Index, Search, FormMethod.Get, new { id
I have the following form: echo $this->Form->input('Person.name'); echo $this->Form->input('Person.phone'); echo $this->Form->input('Person.email'); echo $this->Form->input('Message.0.plainmsg'); echo

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.