DirtySnipe Posted April 24, 2008 Share Posted April 24, 2008 I have a basic form up and running which is used for submiting support requests. but i want to do the following. I want people to fill in a text box called 'email' but i dont want them to put in the full email address. e.g. "[email protected]" I just want them to add the name "me" then i want the form to enter in the from field [email protected] I basically want to add the domain name onto the end so they dont have to put it in. (saves time for them) and it will always be from the same domain because of it being an internal form. Hope you can help. Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/ Share on other sites More sharing options...
micah1701 Posted April 24, 2008 Share Posted April 24, 2008 easy enough. you have an HTML form field like: <input type="text" name="email_username"> then on your PHP processing script just do something like: $email_address = $_POST['email_username']."@mylongdomainname.com"; Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/#findComment-525861 Share on other sites More sharing options...
DirtySnipe Posted April 24, 2008 Author Share Posted April 24, 2008 Thanks will give it a go. Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/#findComment-525862 Share on other sites More sharing options...
DirtySnipe Posted April 24, 2008 Author Share Posted April 24, 2008 its still sending it from the email address in the main php.ini settings here is the code sofar. <?php $to = "[email protected]"; $from = "$Emailaddress"; $Name = $_POST['Name']; $Emailaddress = $_POST['Emailaddress']."@mylongdomainname.com"; $House = $_POST['House']; $Department = $_POST['Department']; $Problem = $_POST['Problem']; $Description = $_POST['Description']; $sub = "$Problem"; $headers = "$from"; $mes .= "$Name\n"; $mes .= "$House\n"; $mes .= "$Department\n"; $mes .= "$Description\n"; mail($to, $sub, $mes, $headers); ?> Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/#findComment-525864 Share on other sites More sharing options...
DirtySnipe Posted April 24, 2008 Author Share Posted April 24, 2008 Ive changed this part $headers = "From: $from\n"; If i put a manual email address in the $from it send it from that person now. But if i want to send it from $from = "$Emailaddress"; I get from UNKNOWN in the email address. Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/#findComment-525873 Share on other sites More sharing options...
DirtySnipe Posted April 24, 2008 Author Share Posted April 24, 2008 Can anyone help? Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/#findComment-525895 Share on other sites More sharing options...
AndyB Posted April 24, 2008 Share Posted April 24, 2008 $to = "[email protected]"; // $from = "$Emailaddress"; $Name = $_POST['Name']; $Emailaddress = $_POST['Emailaddress']."@mylongdomainname.com"; $House = $_POST['House']; $Department = $_POST['Department']; $Problem = $_POST['Problem']; $Description = $_POST['Description']; $from = "$Emailaddress"; // define $from AFTER we know who it's from Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/#findComment-525897 Share on other sites More sharing options...
DirtySnipe Posted April 24, 2008 Author Share Posted April 24, 2008 duuu what an idiot i am. Thanks alot Link to comment https://forums.phpfreaks.com/topic/102682-solved-php-html-form/#findComment-525902 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.