SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Button redirecting to another page using php

    Hi there

    For Some Odd reason my php code which is ment when you click a button you can insert a date into the database but for some odd reason its redirecting to a page called search.php

    which is not in the code itself seems very odd for some reason this is my code

    PHP Code:
        session_start();
        error_reporting(E_ALL);
        $msg_pass="";
        $msg_user="";
        include("dbconnect.php");
        if($_SESSION['user'])
        {
            include("includes/header.inc");
            //
            echo "User is ".$_SESSION['user']."";
            $today=date("F j,Y,g:i a");
            $raQuery="SELECT * FROM members WHERE username='".$_SESSION['user']."'";
            $rs=mysqli_query($con,$raQuery);
            if(!$rs)
            {
                $dbError="Error:Failed to executing query".mysqli_error($con);
            }
            else
            {
                $count=$rs->num_rows;
                if($count>0)
                {
                    $data=$rs->fetch_assoc();
                    $islogged=$data['islogged'];
                    ?>
                    <fieldset>
                    <legend>Clocking Management</legend>
                    First Go Here when you Start Your Shift and When you finish your shift
                    <form name="" method="post" action="">
                    <input type="hidden" name="time" value="<?php echo $today?>">
                    <?        
                
    }
            }
            if(
    $data['islogged']=="0")
            {
                
    //
                
    ?>
                    <input type="submit" name="ClockIn" value="Clock In">
                <?
                
    if(isset($_POST['ClockIn']))
                {    
                    
    /*
                    echo "Clocked in part 1";
                        include("dbconnect.php");
                        $time=$_POST['time'];
                        if($time)
                        {
                            //
                            $dQuery="update users set islogged='2' where username='".$_SESSION['user']."'";
                            $rs=mysqli_query($con,$dQuery);
                            if(!$rs)
                            {
                                echo "<br/>Error:".mysqli_error($con);
                            }
                            else
                            {
                                if(!$islogged=2)
                                {
                                    echo "They arent Clocked in";
                                }
                                else
                                {
                                        //
                                        $lQuery="update users set timein='$time',islogged='2' where username='".$_SESSION['user']."'";
                                        $rs=mysqli_query($con,$lQuery);
                                        if(!$rs)
                                        {
                                            echo "<br/>Error:".mysqli_error($con);
                                        }
                                        else
                                        {
                                            echo "You have Started your shift And/or You are already Clocked in";
                                        }
                                        //
                                }
                            }
                            //
                        }*/
                        
    echo "Button Clicked";
                    }
                
    //
            
    }
            if(
    $islogged="1")
            {
                
    //
                
    ?>
                    <input type="submit" name="Clockout" value="Clock Out">
                <?
                
    //
            
    }
            
    ?></form>
            </fieldset>
            <?php 
            
    //
            
    include("includes/footer.inc");
        }
        else
        {
            include(
    "includes/header.inc");
            include(
    "login.php");
            include(
    "includes/footer.inc");
        }
    That is what it does and i do not have that file it doesnt even echo statements Why is this Happening How can i fix this nothing i can see is doing anything wrong but redirecting on click of the button clock in and clock out.

    How can i fix this?

  2. #2
    SitePoint Zealot
    Join Date
    Oct 2007
    Location
    In the blogosphere
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't see any references to search.php in your code, perhaps you could check your includes?
    bLueFrogX's Blog - Random Ramblings of a NEET Techie ★

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where have you checked/operated your submitted form? It must be somewhere in the included page, so check in one of the included page.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •