FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » Undefined Index Troubles... [Help Please]
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Undefined Index Troubles... [Help Please] [message #26995] Wed, 24 August 2005 10:46 Go to previous message
Linguistic is currently offline  Linguistic   Australia
Messages: 3
Registered: August 2005
Location: Australia
Karma:
Junior Member
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. Smile


Null
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: strange behaviour - fwrite
Next Topic: invalid argument
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 07:17:36 GMT 2024

Total time taken to generate the page: 0.04620 seconds