I'm using a simple form using basic HTML and PHP. Everytime I run the script, I get this message "Notice: Undefined index: action in C:\Inetpub\habboresort\contact.php on line 49" I have no idea what is wrong with my script either. The code as follows: <?php
//Contact Script Made By Jordan Craig
//Define Variables
$your_email="liquid-crystal(at)hotmail(dot)com";
//Show Mail Form
function showForm(){
echo "<form name='contact' method='post' action='contact.php?action=sendEmail' onSubmit='return FormCheck()'>\n"
."<table width='40%' border='1' cellpadding='3' cellspacing='3' bordercolor='#000000' style='border-style: dashed;'>\n"
."<tr>\n"
."<td width='40%' bgcolor='#999999'><strong>Your Habbo Name: </strong><em>Please provide your real Habbo name.</em></td>\n"
."</tr><tr>\n"
."<td bgcolor='#CCCCCC'><input type='text' name='name' size='60'></td>\n"
."</tr><tr>\n"
."<td bgcolor='#999999'><strong>Your Email: </strong><em>Please provide a valid Email address.</em></td>\n"
."</tr><tr>\n"
."<td valign='top' bgcolor='#CCCCCC'><input type='text' name='email' size='60'></td>\n"
."</tr><tr>\n"
."<td valign='top' bgcolor='#999999'><strong>Subject: </strong><em>Please select the most relevant subject for your query.</em></td>\n"
."</tr><tr>\n"
."<td valign='top' bgcolor='#CCCCCC'><select name='subject' size='0'>
<option>Option Goes Here</option>
<option>Option Goes Here</option>
<option>Option Goes Here</option>
<option>Option Goes Here</option>
<option>Option Goes Here</option>
<option>Option Goes Here</option>
</select></td>\n"
."</tr><tr>\n"
."<td valign='top' bgcolor='#999999'><strong>Your Message: </strong><em>Please provide any additional information via this field.</em></td>\n"
."</tr><tr>\n"
."<td valign='top' bgcolor='#CCCCCC'><textarea name='message' rows='5' cols='45'></textarea></td>\n"
."</tr><tr>\n"
."<td align='right' valign='top' bgcolor='#999999'><input name='submit' type='submit' value='Submit Query'>\n<input name='reset' type='reset' value='Reset All Fields'></td>\n"
."</tr></table>\n";
}
//Send Email
function sendEmail(){
global $your_email,$name,$email,$subject,$message;
if ( !$name | !$email | !$subject | !$message ){
header ("Location: contact.php");
}else{
$email2 = "$email ($name)";
mail ( $your_email, $subject, $message, "From: $email2");
echo "<h1>Your query was successfully sent!</h1>\n"
."</head><body>\n";
}
}
//Switch Statement
switch ( $_GET['action'] ){
case 'sendEmail':
sendEmail();
break;
default:
showForm();
}
?>
Any help would be much appreciated.