q. Data not posting mysql table

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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.






 if ($_Post['submit']) {
$conn = mysql_connect("mysql", "TeacherCards", "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($sql);



  // 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">



 // end if


Re: q. Data not posting mysql table

 .oO(Willoughby Bridge)

Quoted text here. Click to load it

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


Site Timeline