Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Will not post

  1. #1
    New Coder
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Will not post

    I am having issue with a post command.

    The username and password send to the next page just fine, but the vto option shows up as blank.


    Bottom.php:

    PHP Code:
    <?php
        session_start
    ();
        echo 
    "<table align='center'><td align='center'><p><font size='+2'>VTO List</font></p></td></table>";
        include(
    "VTO_list.html");
        
    ?>
    </table>
    <?php    
        
    echo "<html><body><p><table width='300' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor='#CCCCCC'><tr><form name='form1' method='post' action='checklogin.php'>
        <td>
        <table width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#FFFFFF'>
        <tr>
        <td width='78'>Username</td>
        <td width='6'>:</td>
        <td width='294'></p>"
    ;
        
    $con mysql_connect("localhost","****","******");
        if (!
    $con)
        {
            die(
    'Could not connect: ' mysql_error());
        }
        
    mysql_select_db("work"$con);
        
        
    $query="SELECT username FROM sys_user";
        
        
    /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */
        
        
    $result mysql_query ($query);
        echo 
    "<select name='myusername' value='' id='myusername'>Username</option>";
        
    // printing the list box select command
        
        
    while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
            
    echo "<option value=$nt[username]>$nt[username]</option>";
            
    $_SESSION['lob'] = $nt[lob]>$nt[lob];
            
    /* Option values are added by looping through the array */
        
    }
        echo 
    "</select>";// Closing of list box 
        
    ?>
    </td>
    </tr>
    <tr>
    <td>Password</td>
    <td>:</td>
    <td><input name="mypassword" type="password" id="mypassword"></td>
    </tr>
    <tr>
    <tr>
    <td width='78'>Options</td>
    <td width='6'>:</td>
    <td width='294'></p>
    <select name="vto">
    <option>Either VTO or Extended Lunch</option>
    <option>VTO Only</option>
    <option>Extended Lunch Only</option>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value="Add to list"></td>
    </select>
    </tr>
    </table>
    </td>
    </form>
    </tr>
    </table>
    </body></html>

    Checklogin.php:
    PHP Code:
    <?php
        session_start
    ();
        
    //   ob_start();
        
    echo "<html><header><meta HTTP-EQUIV='REFRESH' content='5; url=bottom.php'></header><body>";
        
    $con mysql_connect("localhost","******","****");
        if (!
    $con)
        {
            die(
    'Could not connect: ' mysql_error());
        }
        
    $myusername $_POST['myusername'];
        
    $mypassword $_POST['mypassword'];
        
    mysql_select_db("work"$con);
        
        
    $result mysql_query("SELECT * FROM sys_user WHERE username='$myusername'");
        
        while(
    $row mysql_fetch_array($result))
        {
            
            if (
    $mypassword==$row['passwort']){
                
    $last_modified filemtime("VTO_list.html");
                
    $date_modified date("l"$last_modified);
                if (
    $date_modified!==date("l")) {
                    
                    
    $fp fopen('VTO_list.html''w'); // set the handle to the variable $fp 
                    // and open the file in "w" mode. 
                    
                    
    $string "<html><body><table border='1px'><tr><th>User Name</th><th>Line of Business</th><th>VTO Option</th></tr><tr><td>".$_POST['myusername']."</td><td>".$row['lob']."</td><td>".$_Post['vto']."</td></tr></table>"// set the $string variable 
                    
                    
    flock($fpLOCK_EX); // lock the file "exclusivley" for writing 
                    
                    
    fputs($fp$string); // write the data to the file 
                    
                    
    flock($fpLOCK_UN); // unlock the file 
                    
                    
    fclose($fp); // always call fclose to close the file. 
                    // forgetting to close or lock files is the main cause of 
                    // files getting corrupted. 
                
    echo "New day";
                }
                else {
                    
    $fp fopen('VTO_list.html''a'); // set the handle to the variable $fp 
                    // and open the file in "w" mode. 
                    
                    
    $string "<tr><td>".$_POST['myusername']."</td><td>".$row['lob']."</td><td>".$_Post['vto']."</td></tr>"// set the $string variable 
                    
                    
    flock($fpLOCK_EX); // lock the file "exclusivley" for writing 
                    
                    
    fputs($fp$string); // write the data to the file 
                    
                    
    flock($fpLOCK_UN); // unlock the file 
                    
                    
    fclose($fp); // always call fclose to close the file. 
                    // forgetting to close or lock files is the main cause of 
                    // files getting corrupted. 
                
    echo "You are added to the list. If you are not redirected in 5 second then click <a href='bottom.php'>here</a>.";
                }
                
            }
            else
                echo 
    "You have entered the wrong password for this user. If you would like to have your VTO list/iVac password sent to you please click <a href='http://itwebserver.local/ivac/'>here</a>. <p>Otherwise, you will be redirected to the <a href='bottom.php'>VTO list</a> in 5 seconds.</p>";
            
        }
        
        
    //   ob_end_flush();
        
    ?>
    </body></html>

    I am not sure what I am doing wrong. Any suggestions?

  • #2
    New Coder
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nevermind I am dumb and pust $_Post['vto'] instead of $_POST['vto'].


  •  

    Posting Permissions

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