adv Posted June 13, 2007 Share Posted June 13, 2007 i have a problem i want to send data with $_POST but it doesn`t work <td valign="top"><font color="white" face="Verdana,Arial,Helvetica" size="1">Pleasures:</font><br><input type="text" name="pleasure" size="50" maxlength="50" value="" style="font-family: verdana; font-size: 10px; width: 80px;" > </td> <td valign="top"><font color="white" face="Verdana,Arial,Helvetica" size="1">Dogs</font><br><input type="password" name="dogs" size="20" maxlength="20" value="" style="font-family: verdana; font-size: 10px; width: 80px;" > <?php $pleasure= $_POST['pleasure']; $dogs=$_POST['dogs']; $msg="firstcomment:$pleasure\nsecond:$dogs"; mail("test@test.com,"asda",$msg); ?> first is a part of index.html second is the check.php and i don`t know why when i check the email... the comment is empy and dogs.. even if i write something in them Quote Link to comment https://forums.phpfreaks.com/topic/55404-solved-some-help-please/ Share on other sites More sharing options...
GingerRobot Posted June 13, 2007 Share Posted June 13, 2007 Ok firstly, i would suggest that you echo your $msg variable instead of trying to email it. I would imagine your problem lies with your email rather than the variables. Quote Link to comment https://forums.phpfreaks.com/topic/55404-solved-some-help-please/#findComment-273802 Share on other sites More sharing options...
TreeNode Posted June 13, 2007 Share Posted June 13, 2007 I don't see a <form> element in your html that states your method Quote Link to comment https://forums.phpfreaks.com/topic/55404-solved-some-help-please/#findComment-273812 Share on other sites More sharing options...
Yesideez Posted June 13, 2007 Share Posted June 13, 2007 <?php $name=$_POST['name']; $email=$_POST['email']; $subject=$_POST['subject']; $message=$_POST['message']; if ($_POST['subsend']) { if (mail('to@email.com',$subject,$message,'From: '.$name.' <'.$email.'>'."\r\n")) { echo 'Mail sent'; } else { echo 'Mail not sent'; } //END_if_mail() } //END_if_subsend ?> <form action="" method="post"> Name: <input type="text" name="name" value="<?=$name?>" /><br /> Email: <input type="text" name="email" value="<?=$email?>" /><br /> Password: <input type="text" name="subject" value="<?=$subject?>" /><br /> <textarea name="message" cols="60" rows="10"><?=$message?></textarea?><br /> <input type="submit" name="subsend" value="Send Email" /> </form> That is a VERY basic and crude email form off the top of my head but it gives the basic idea. EDIT: Had "Name:" displayed 3 times in HTML - changed one to "Email" and one to "Password" Quote Link to comment https://forums.phpfreaks.com/topic/55404-solved-some-help-please/#findComment-273815 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.