Menu

data from form looses data on the way

Anonymous
2003-06-16
2003-06-16
  • Anonymous

    Anonymous - 2003-06-16

    Thank you first, for looking at this, I appreciate your help.

    My problem seems to be that the data I enter into the form doesn't make it to the insert file's values. I put real values where the variables are
    ...example: Instead of '$StudentNameField' I put 'name of student', submit,  then checked my database and saw that the fields had the appropriate data in them. I'm guessing it's something really simplistic?

    This is my form
    -->
    <?

    include("datacon.php");
    ?>

    <h2>Enter a New TAPS</h2>
    <form name=formMaker method=post action="insertTAPS.php">
    <table>

    <tr height=30 valign=top>
    <td align=right><b>StudentName :</b></td>
    <td>
        <input type="text" name="StudentNameField">
    </td>
    </tr>

    <tr height=30 valign=top>
    <td align=right><b>PointsEarned :</b></td>
    <td>
        <input type="text" name="PointsEarnedField">
    </td>
    </tr>

    <tr height=30 valign=top>
    <td align=right><b>Cottage :</b></td>
    <td>
        <input type="text" name="CottageField">
    </td>
    </tr>

    </table>

    <input type=submit name=Submit value="Submit">
    <input type=reset name=Submit2 value="Reset">
    </form>
    <--

    This is my insert

    -->
    <?

    include("datacon.php");
    ?>

    <?

    $query="insert into TAPS (StudentName,PointsEarned,Cottage) VALUES ('$StudentNameField','$PointsEarnedField','$CottageField')";

    $result = MYSQL_QUERY($query);

      

    ?>

    <H2>New TAPS Created !!</H2>

    <table>
    <tr height=30>
    <td align=right><b>StudentName :</b></td>
    <td><font color=blue><b><? echo $StudentNameField; ?></font></b></td>
    </tr>
    <tr height=30>
    <td align=right><b>PointsEarned :</b></td>
    <td><font color=blue><b><? echo $PointsEarnedField; ?></font></b></td>
    </tr>
    <tr height=30>
    <td align=right><b>Cottage :</b></td>
    <td><font color=blue><b><? echo $CottageField; ?></font></b></td>
    </tr>
    </table><br><br>
    Click <a href="index.php">here</a> to go back to Main Menu<br><br>

    <?
    echo $query;
    ?>

     
    • Nilesh Dosooye

      Nilesh Dosooye - 2003-06-16

      I think this problem is happenning because register_globals is turned off in the version of php that you are using. I'll soon put out a new version of codeGenie that will have this problem resolved. But as of now, what you can do to fix them...

      for every form element in your form, you have to type a line like this in your script

      $StudentNameField = $_GET['StudentNameField'];
      $PointsEarnedField = $_GET['PointsEarnedField'];
      etc.. etc..

      on top of your script code...

      Thanks,
      Nilesh

       
    • Anonymous

      Anonymous - 2003-06-16

      I'm using 4.2.1 ...global registry is off.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.