I am working on a login page and its process and started having problem where the browser cannot detect the new changes I made to my PHP file.

Here's the HTML code for the login page (ptLogin.php):

<form name="ptlogin" method="post" action="ptLogin0.php">
              <div align="center" class="style2"><br>
            <table width="330" border="0">
              <tr>
            <td width="90" class="style5 style9">ID Pengguna</td>
            <td width="11"><span class="style5 style9">:</span></td>
                <td width="215"><input name="ptLoginId" type="text" class="style9" id="lectLoginId" size="25" maxlength="10"></td>
              </tr>
      
              <tr>
            <td><span class="style5 style9">Katalaluan</span></td>
            <td><span class="style5 style9">:</span></td>
            <td><span class="style5 style9">
              <label>
              <input name="ptLoginPw" type="password" id="lectLoginPw" size="25" maxlength="10">
              </label>
            </span></td>
              </tr>
            </table>

            <table width="142" border="0" align="center">
              <tr>
            <td width="54"><input name="Masuk" type="submit" id="Masuk" value="Masuk" class="style9"></td>
            <td width="292"><input name="Kosongkan" type="reset" id="Kosongkan" value="Kosongkan" class="style9"></td>
            </tr>
            </table><label></label>
            
    </div><br>
    </form>

As you can see, I have ptLogin0.php for the form to process. However, when I run it on the browser (using Mozilla Firefox), after clicking the Submit (Masuk) button, it leads me to the previous link I was using (heaLogin.php to be exact).

I don't think it has anything to do with the process file, but here's the code for ptLogin0 anyway.

<?php
session_start();
/* include db connection file */
include("dbconn.php");

if(isset($_POST['Masuk']))
{
/* capture values from HTML form */
$pt_id = $_POST['ptLoginId'];
$pt_pw = $_POST['ptLoginPw'];

$sql= "SELECT * FROM hea WHERE pt_username= '$pt_id' AND pt_password= '$pt_pw'";
$query = mysql_query($sql) or die("Error: " . mysql_error());
$row = mysql_num_rows($query);
    if($row == 0)
    {    header("Location:heaLoginError.php");    }

    else
    {
        $r = mysql_fetch_assoc($query);
        $_SESSION['ptLoginId'] = $r['pt_username'];
        $_SESSION['heaNokp'] = $r['pt_id']; /*1st var: textbox - 2nd var: db*/
        header("Location:ptMainMenu.php");
    }

} /*close isset*/
mysql_close($dbconn);?>

Hope someone can point me to the right direction, since this is the first time I've encountered this problem. Thanks.

It may be because it has the previous code cached (the generated html). If you reload / refresh the page, that usually clears it. If that doesn't do it, you may need to close and re-open your browser. Sometimes it is something stupid like saving the modified code somewhere other than where you are actually executing it from. Having been through this before, these probably explain 99% of these situations. If that doesn't do it, then you have to look at the code itself and see if that is the cause (I didn't go through the code above).

Hi Chris,

I've checked the location of the files and they are in the right directory. It could be the first problem you've mentioned. I tried refreshing the page and relaunching my browser but it still brings me to the old link. Are these to fix the cached code problem? If they're not, is there anything I can do? Work on the files involved from scratch?

Thanks.

It may be because it has the previous code cached (the generated html). If you reload / refresh the page

chrishea is correct
this often happens also your server may take a while to update the file (or server has done a backup & restored the old file during your update)

In Firefox you can clear history & cache from the TOOLS menu to be sure you are not accessing a cached file.
or
you could insert the code of "ptLogin0.php" into file "heaLogin.php" as a temporary measure.


Hope this helps

I deleted history and the problem didn't go away, and it started linking to several other pages that had to do with the login.

What solved it? Reinstalling Xampp :| Thanks guys, for your suggestions. They're definitely something to keep in mind, should something like this reoccurs :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.