Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-24-2005, 10:38 PM Form Mail Help
Junior Talker

Posts: 2
Trades: 0
Hello, well im trying to get a form to send its contents to me.. unluckily, its not working.

I have tried many formmail scripts - PHP and CGI - followed the readme's, but none have worked.. i always get a different error on each one.

Right now i have it set for the php mail function, but its not working either, it just refreshes the page when i press submit, but i dont get the email..

Form Code:
Code:
<form method="post" action="" name="form1">
<tr>
             <td align="left" valign="middle">Nickname</td>
             <td width="400" align="left" valign="middle"><input type="text" name="nickname"></td></tr>
        <tr><td align="left" valign="middle">Age</td> <td width="400" align="left" valign="middle"><input type="text" name="age"></td></tr>
       <tr><td align="left" valign="middle">Location</td> <td width="400" align="left" valign="middle"><input type="text" name="location"></td></tr>
      <tr><td align="left" valign="middle">Email</td> <td width="400" align="left" valign="middle"><input name="email" type="text" /></td></tr>
      <tr><td align="left" valign="middle">AIM</td> <td width="400" align="left" valign="middle"><input type="text" name="aim"></td></tr>
      <tr><td align="left" valign="middle">Are you willing to donate money? (Paypal or Mail)</td> <td width="400" align="left" valign="middle">
      <p>
                   <label>
                   <input type="radio" name="donate" value="Yes">
 Yes</label>
                   <br>
                   <label>
                   <input type="radio" name="donate" value="No">
 No</label>
                   <br>
                 </p></td></tr>
     
      <tr><td align="left" valign="middle">Have you been an Admin before?</td> <td width="400" align="left" valign="middle">
      <p>
                   <label>
                   <input type="radio" name="experience" value="Yes">
 Yes</label>
                   <br>
                   <label>
                   <input type="radio" name="experience" value="No">
 No</label>
                   <br>
                 </p></td></tr>
     
     <tr><td align="left" valign="middle">Do you know the AMXX commands?</td> <td width="400" align="left" valign="middle">
      <p>
                   <label>
                   <input type="radio" name="amxx" value="Yes">
 Yes</label>
                   <br>
                   <label>
                   <input type="radio" name="amxx" value="No">
 No</label>
                   <br>
                 </p></td></tr>
     <tr><td align="left" valign="middle">At what times will you be available?</td> <td width="400" align="left" valign="middle"><input type="text" name="available"></td></tr>
     <tr>
       <td align="left" valign="middle">Why do you want to become an Admin?&nbsp;</td>
       <td width="400" align="left" valign="middle"><textarea wrap="soft" name="why" cols="35" rows="5"></textarea></td></tr>
   
    <tr><td align="left" valign="middle">Do you promise not to abuse Admin?</td> <td width="400" align="left" valign="middle"><input name="abuse" type="checkbox" value="Yes">
    Yes </td>
    </tr>
    <tr><td width="400" align="left" valign="middle"></td>
        <td width="400" align="left" valign="middle"><input name="Submit" type="submit" value="Submit">                        
    </tr>
                              </form>
Mail Code:
Code:
 <?php


if ($submit) { // if this is submited

// error messages (if nothing in box sends error) //
if ($nickname <= "")
$error = "Please enter Name";
else if ($email <= "")
$error = "Please enter Email";
else if ($abuse <= "")
$error = "You must checkbox yes, and agree to not abusing admin!";

if ($error) // if there is a error
echo ($error);
else { // and if there not do this
mail("nyxero@hotmail.com", "Contact", "nickname: $nickname\nemail: $email\nage: $age","From: $nickname <$email>");

Echo("Thank you $name,\nyour information has been sent thank you.");


}

}

?>



(Right now the mail php code isnt setup for all the form inputs, as i wanted to test if it worked first.. but it didnt.)

Any help is appreciated, thank you!
Noxel is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-24-2005, 11:14 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Your form's action is not set, you need to set the action to the page where the php script resides.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 06-24-2005, 11:37 PM
Junior Talker

Posts: 2
Trades: 0
both codes are on the same file, which is a .php file.

**

Ok, i tried putting the mail func code on a new .PHP file and added the action to the form.. but still no e-mail sent =\

**

Edit:

if you want to see it in action:
http://teamloa.com/becomeadmin.php

Last edited by Noxel; 06-24-2005 at 11:41 PM..
Noxel is offline
Reply With Quote
View Public Profile
 
Old 06-25-2005, 03:30 AM
Raulică's Avatar
Ultra Talker

Posts: 253
Location: Constanta,Romania
Trades: 0
You must define first the variables so any mail could be sent
PHP Code:
$email $_POST['email'];
$nickname $_POST['nickname']; // etc..
//...
//now for the if's
//if( $nickname  <= "") i guess it wont work i suggest you try this
if(!strlen($nickname))
{
$error ="Please enter nickname<br>";
}
if(!
strlen($email))
{
$error .= "Please enter your email<br>"// we need the .= so $error can keep the last value too
}
//etc.. i hope you got it. 
__________________

Please login or register to view this content. Registration is FREE

Professional hosting for all pockets!

Please login or register to view this content. Registration is FREE
Raulică is offline
Reply With Quote
View Public Profile Visit Raulică's homepage!
 
Old 06-25-2005, 09:19 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Noxel, you can keep all your code inside the same page if you like you would have to just set your forms action to the exact same page.

Raulica is right as well, you should not assume that register_globals is on by default.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 06-25-2005, 09:27 AM
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
I guess he didn't read the manually very well, he picked up those code somewhere else.
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Reply     « Reply to Form Mail Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26256 seconds with 12 queries