Forum Moderators: coopster

Message Too Old, No Replies

PHP Form Validation

Help!

         

kaymeis

7:20 pm on Jul 20, 2006 (gmt 0)

10+ Year Member



I'm doin a Web Programming Course and we were asked to do a simple contact for. for some reason it's not running. Can someone tell me why?

here is the code:

<?php
IF(ISSET($_POST['submit'])){
$NAME = $_POST ['name'];
$EMAIL = $_POST ['email'];
$SUBJECT = $_POST ['_subject'];
$MESSAGE = $_POST ['message'];
include 'config.php';
include 'opendb.php';
$result = mysql_query($query);
ELSE {
ECHO $Name;
ECHO $EMAIL;
ECHO $SUBJECT;
ECHO $MESSAGE;
}
mysql_connect($dbhost, $dbuser, $dbpass)
or die('cannot select database');
?>
<html>
<head>
<title>Personal Information</title>
</head>
<body>
<table width="650" border="0" align="center" cellspacing="0">
<tr>
<form method="post" name="msgform">
<table width="500" border="0" align="center" cellpadding="2" cellspacing="1">
<tr>
<td width="106">Your Name</td>
<td width="381"><input name="name" type="text" class="box" id="name" size="30" value=""></td>
</tr>
<tr>
<td>Your Email</td>
<td><input name="email" type="text" id="mail" size="30" value=""></td>
</tr>
<tr>
<td>Subject</td>
<td><input name="subject" type="text" id="subject" size="30" value=""></td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="message" cols="55" id="message"></textarea></td>
</tr>
<tr align="center">
<td colspan="2"><input name="send" type="submit" id="send" value="Send Message" onClick="return checkForm();"></td>
</tr>
<tr align="center">
<td colspan="2">&nbsp;</td>
</tr>
</form>
</table>
</body>
</html>
?>

thanx

dreamcatcher

8:28 pm on Jul 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi kaymeis,

Try changing this:


IF(ISSET($_POST['submit'])){

to this:


if(isset($_POST['send'])){

Also, try setting your error reporting to E_ALL to show undefined errors. $_POST['submit'] doesn`t exist, which is why its failing.

dc