View previous topic :: View next topic |
Author |
Message |
catalfamo1220 -
Joined: 08 Jan 2005 Posts: 3
|
Posted: Wed Jan 19, 2005 1:02 pm Post subject: First script: Undefined Index Errors |
|
|
Hello,
I get these following errors when I run my PHP script I wrote. It's a simple one that is supposed to send form information to my e mail address.
Notice: Undefined index: firstname in C:\Program Files\Abyss Web Server\htdocs\waldosignup.php on line 2
Notice: Undefined index: lastname in C:\Program Files\Abyss Web Server\htdocs\waldosignup.php on line 3
Notice: Undefined index: address in C:\Program Files\Abyss Web Server\htdocs\waldosignup.php on line 4
Notice: Undefined index: email in C:\Program Files\Abyss Web Server\htdocs\waldosignup.php on line 5
Notice: Undefined index: phone in C:\Program Files\Abyss Web Server\htdocs\waldosignup.php on line 6
THe PHP script is as follows:
Code: |
<?php
$firstname=$_POST["firstname"];
$lastname=$_POST["lastname"];
$address=$_POST["address"];
$email=$_POST["email"];
$phone=$_POST["phone"];
$to="pwapilot@cox.net";
$message="Application\n $firstname $lastname\n $address\n $email\n $phone\n";
if(mail($to,"Waldo Application",$message,"From:$email\n")){
echo "Thanks for applyling. You will hear from the president within the next 24 hours with further information.";
}else{
echo"There was a problem sending your application. Please check that you filled in the form correctly.";
}
?>
|
I don't know if there is a little markup problem in my script, or am I doing something totally wrong. I tried searching the forums, but nothing seemed to pertain to my problem.
Thanks in advance.
Mike Catalfamo |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Wed Jan 19, 2005 1:08 pm Post subject: |
|
|
Please do a search next time , its right at the top of the forum , these are
just notices , nothing to worry about , to disable these have a look at this.
http://www.aprelium.com/forum/viewtopic.php?t=5207 |
|
Back to top |
|
 |
catalfamo1220 -
Joined: 08 Jan 2005 Posts: 3
|
Posted: Wed Jan 19, 2005 9:30 pm Post subject: |
|
|
Okay, thanks. I just have 1 more problem now; I don't get any of the information entered in the form in the E-Mail I get. The only thing it says in the body is "Application". Not even a subject. I thought that there may be a problem with my HTML code, but it looks fine. The form code is as follows is someone wants to give it a quick check:
Code: |
<form action="waldosignup.php" action="post">
<p>First Name: <input type="text" name="firstname" size="30" maxlength="30"></p>
<p>Last Name: <input type="text" name="lastname" size="30" maxlength="30"></p>
<p>Street Address: <input type="text" name="address" size="30" maxlength="30"></p>
<p>E-Mail Address: <input type="text" name="email" size="30" maxlength="30"></p>
<p>Phone Number: <input type="text" name="phone" size="30" maxlength="30"></p>
<p><input type="image" value="Submit" src="img/submit.jpg" alt="Submit"></p>
</form>
|
So, if it isn't that, they what's wrong with my PHP?
Thanks again,
Mike |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Thu Jan 20, 2005 1:22 am Post subject: |
|
|
catalfamo1220 wrote: | Okay, thanks. I just have 1 more problem now; I don't get any of the information entered in the form in the E-Mail I get. The only thing it says in the body is "Application". Not even a subject. I thought that there may be a problem with my HTML code, but it looks fine. The form code is as follows is someone wants to give it a quick check:
Code: |
<form action="waldosignup.php" action="post">
<p>First Name: <input type="text" name="firstname" size="30" maxlength="30"></p>
<p>Last Name: <input type="text" name="lastname" size="30" maxlength="30"></p>
<p>Street Address: <input type="text" name="address" size="30" maxlength="30"></p>
<p>E-Mail Address: <input type="text" name="email" size="30" maxlength="30"></p>
<p>Phone Number: <input type="text" name="phone" size="30" maxlength="30"></p>
<p><input type="image" value="Submit" src="img/submit.jpg" alt="Submit"></p>
</form>
|
So, if it isn't that, they what's wrong with my PHP?
Thanks again,
Mike |
Your code is wrong because when I fixed it , it worked for me , you need to
change action="post" to method="post" , hope your enjoying PHP. LateR!
Example:
Code: | <form action="file.php" method="post"> |
|
|
Back to top |
|
 |
k1ll3rdr4g0n -
Joined: 04 Jul 2004 Posts: 609
|
Posted: Thu Jan 20, 2005 5:17 pm Post subject: |
|
|
You need to change the error level that PHP will report in your PHP.ini file or theres a script config for it, however i forgot what it was where it wont display any errors :\. All that notice error means is that there is nothing stored in those variables (yet)... _________________
 |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Jan 21, 2005 12:29 am Post subject: |
|
|
To answer your question k1ll3rdr4g0n , the code is listed below , just put
these two lines of code at the beginning of your php code after the <?php
Code: |
error_reporting(E_ALL & ~E_NOTICE);
ini_set("display_errors", 1); |
Note: Now only critical errors will be displayed , I recommend just disabling
errors all together , showing errors can cause problems in the future so you
should disable all errors by setting display_errors=On to Off , LateR!
Last edited by TRUSTAbyss on Fri Jan 21, 2005 2:15 am; edited 1 time in total |
|
Back to top |
|
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Fri Jan 21, 2005 1:34 am Post subject: |
|
|
TRUSTpunk wrote: | To answer your question Anonymoose |
Thanks for the tip, but how did I end up in this thread? ;) |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Jan 21, 2005 2:14 am Post subject: |
|
|
Wow , I must be loosing my mind , I thought you where k1ll3rdr4g0n , sorry
about that , I guess I was refering to k1ll3rdr4g0n for that question lol...
Edit: I fixed the post to refer to k1ll3rdr4g0n's question lol. |
|
Back to top |
|
 |
|