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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:32:30+00:00 2026-06-11T10:32:30+00:00

<form action=userLogin.php method=post> <div id=login> <div id=submit class=h>Log In</div> &nbsp;Email <br> &nbsp;<input id=email name=email

  • 0
<form action=userLogin.php method=post>
    <div id="login">
        <div id="submit" class="h">Log In</div>
        &nbsp;Email
        <br>
        &nbsp;<input id="email" name="email" type="email" required>
        <br>
        &nbsp;Password
        <br>
        &nbsp;<input name="pass" type="password" required=required><br>
        &nbsp;<a href="recover.php">Forgot your password</a><br>

        <div id="submit">
            <input type="checkbox">&nbsp;Remember&nbsp;&nbsp;
            <div id="h">
                <input type="submit" value="Log in"></div>
        </div>
    </div>
<?php
if (empty($_POST['pass']) == false) {
    $uname = $_POST['email'];

    $pass = $_POST['pass'];

    include("config.php");
    $query   = $mysqli->query("SELECT * FROM user WHERE email='$uname' AND password='$pass'");
    $numrows = mysqli_num_rows($query);
    while ($row = mysqli_fetch_array($query)) {

        if ($numrows == 0) {
            ?>
            <script>
                $(document).ready(function () {
                    $("#alert").fadeIn();
                });</script>
        <?php
        }
        else {
            $id = $row[id];
            setcookie('userId', $id);


        }
    }
}
?>

This is my code which get user data and check whether the user exists or not and set cookie on the user’s browser.
When i check that the cookie is set I could see only phpMyAdmin cookies not my userId cookie.You can see the screenshotenter image description here and the browser got stucked and its automatically closed
But when i editted setcookie function with setcookie('userId','$id'); the cookie was set but its value is %24id[$id]. So how can i set the cookie in the value of the variable $row[id] is the error with my pc or server or with my code?
When i used chrome with $id without qoutes the error came This webpage is not available The webpage at localhost/mysite/mysite/userLogin.php might be temporarily down or it may have moved permanently to a new web address

  • 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-11T10:32:31+00:00Added an answer on June 11, 2026 at 10:32 am

    cookies have to be sent with headers.

    “setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including and tags as well as any whitespace.”

    http://php.net/manual/en/function.setcookie.php

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

Sidebar

Related Questions

<form action=inc/login/login.php method=post id=userLogon> <div class=field required> Username: <input type=text name=regduser tabindex=1 /><br />
<form action = settings.php method = post> Student ID*: <input type = text name
This is my login.php <form action=index.php method=get> <?php error_reporting(E_ALL & ~E_NOTICE); ?> <?php session_start();
HTML <form style=margin:5px 0; action=# method=post> Buyer <input type=radio name=addType value=Buyer /> &nbsp;&nbsp;Merchant <input
HTML: <form style=margin:5px 0; action=# method=post> Buyer <input type=radio name=addType value=Buyer /> &nbsp;&nbsp;Merchant <input
Consider: <form action="?login" method="post"> <button>Login with Google</button> </form> I usually see the action refer
I have a form: %form{:action:method => post} %fieldset %label{:for => title} Title: %input{:name =>
it it possible to get the form action of a GET form on submit
I am having problem with overriding Form Action URL I have a class to
I have a jsp with a submit based on the html:form action. <html:form action=/nextPath>

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.