SysInfo: Apache/1.3.24 (Win32) PHP/4.1.3-dev
I have a question that could be Apache, could be php, but I'm so new to this I have to
ask: what is wrong with my code for the form action? Apache does not recognize the <?
as the beginning of php code and gives an error "filename is not valid" whenever this
form is submitted [note: phpinfo() and several other php files work with no problem]?
<FORM ACTION="<? echo( $PHP_SELF); ?>" METHOD=POST>
SSN: <INPUT TYPE=INT NAME="ssn"><BR>
First Name: <INPUT TYPE=TEXT NAME="firstname"><BR>
Last Name: <INPUT TYPE=TEXT NAME="lastname"><BR>
Employer: <INPUT TYPE=TEXT NAME="employer"><BR>
Comments: <INPUT TYPE=TEXT NAME="comments"><BR>
<CENTER>
<INPUT TYPE=SUBMIT NAME="submitalumni" VALUE="SUBMIT">
</CENTER>
</FORM>
<?
// Connect to the db server
$dbconn = @mysql_connect("localhost", "root", "password");
if (!$dbconn) {
echo( "<P>Unable to connect to the database server at this time.</P>" );
exit();
}
// Select the Alumni db
if(! @mysql_select_db("Alumni") ) {
echo( "<P>Unable to locate the Alumni db at this time.</P>" );
exit();
}
// If an alumni information record has been submitted
if ("SUBMIT" == $submitalumni) {
$sql = "INSERT INTO Alumni SET " .
"SSN='$ssn', " .
"FIRST_NAME='$firstname', " .
"LAST_NAME='$lastname', " .
"EMPLOYER='$employer', " .
"COMMENTS='$comments' ";
if (mysql_query($sql)) {
echo( "<p>Your alumni information has been added.</p>");
} else {
echo( "<P>Error adding submitted alumni information: " .
mysql_error() . "</P>");
}
}
echo("<P> Here are all the Alumni in our database: </P>");
// Request all alumni entries
$result=mysql_query(
"SELECT * from alumni");
if (!$result) {
echo( "<P>Error performing query: " . mysql_error() . "</P>");
exit();
}
// display alumni info in paragraph form
while ( $row = mysql_fetch_array($result) ) {
echo( "<P>" . $row["SSN"] . "</P>");
}
?>
THANKS for your help! - Kirk