q. Data not posting mysql table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Willoughby Bridge

    q. Data not posting mysql table

    I am trying to post from a form to table using the code below from file2.php
    and having two problems:
    1. The data is not being posted to the table
    2. After submit is pressed the following message comes up: "The page cannot
    be displayed" - The browser can't find the file, because it is looking for
    http://file2.php instead of http://teachercards.org//file2.php

    Any help would be greatly appreciated.

    TIA

    David

    <html>

    <body>

    <?php

    if ($_Post['submit']) {
    $conn = mysql_connect(" mysql", "TeacherCar ds", "164333") or die("Cannot
    connect to server");
    mysql_select_db ("Teachercards" ,$conn) or die("Cannot find database");
    $sql = "INSERT INTO Teachers2 (Name, College, Subject)
    VALUES('$_Post[Name]', '$_Post[College]', '$_Post[$Subject]')";
    $result = mysql_query($sq l);

    }

    Else

    {
    // display form


    ?>


    <form method="post" action="<?php echo $PHP_SELF?>">

    Name:<input type="Text" name="Name"><br >

    College:<input type="Text" name="College"> <br>

    Subject:<input type="Text" name="Subject"> <br>

    <input type="submit" name="submit" value="Enter information">

    </form>

    <?php

    }
    // end if


    ?>


  • Michael Fesser

    #2
    Re: q. Data not posting mysql table

    .oO(Willoughby Bridge)
    [color=blue]
    >I am trying to post from a form to table using the code below from file2.php
    >and having two problems:
    >1. The data is not being posted to the table[/color]

    Set error_reporting to E_ALL in your php.ini, you'll get some notices
    (hint: variable names are case-sensitive in PHP).

    Micha

    Comment

    Working...