Activity › Forums › Web Design (WordPress, Joomla, etc.) › php email form
-
php email form
Posted by Greg Parrott on December 13, 2010 at 2:40 pmi have recently been creating a website for a wholesale butchers and one of their requirements are that they want a request from emailed to their sales department. i have used sendresults.php however it only shows one item out of a field with more than one product selected. i am wandering how to get this script to show all that is selected in the form and not just one item from each field
Fernando Mol replied 15 years, 8 months ago 3 Members · 3 Replies -
3 Replies
-
Richard Williams
December 13, 2010 at 7:35 pmwhat is sendresults.php?
There are two post that can help you build your own PHP script, here is one
and the other is HERE
If you read the code from the first post link, i typed instructions explaining what i was doing and what each element is and why it works… so you aught to be able to do something very similar and create your very own php script to do whatever you want it to do.
If i have misunderstood your post, please show us the code of the form you are using and the php used to send the info.
Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o) -
Greg Parrott
December 14, 2010 at 9:28 amthis is the send sendresults.php which sends what ever is on the form
<?php
//————————–Set these paramaters————————–// Subject of email sent to you.
$subject = ‘Order Request’;// Your email address. This is where the form information will be sent.
$emailadd = ‘greg@parrott.co.uk’;// Where to redirect after form is processed.
$url = ‘https://www.absalomandtribe.co.uk/index.html’;// Makes all fields required. If set to ‘1’ no field can not be empty. If set to ‘0’ any or all fields can be empty.
$req = ‘0’;// ————————–Do not edit below this line————————–
$text = “Results from form:\n\n”;
$space = ‘ ‘;
$line = ‘
‘;
foreach ($_POST as $key => $value)
{
if ($req == ‘1’)
{
if ($value == ”)
{echo “$key is empty”;die;}
}
$j = strlen($key);
if ($j >= 500000)
{echo “Name of form element $key cannot be longer than 500000 characters”;die;}
$j = 20 – $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ‘ ‘;}
$value = str_replace(‘\n’, “$line”, $value);
$conc = “{$key}:$space{$value}$line”;
$text .= $conc;
$space = ‘ ‘;
}
mail($emailadd, $subject, $text, ‘From: ‘.$emailadd.”);
echo ”;
?> -
Fernando Mol
December 30, 2010 at 11:50 pmWithout looking at your Form code all I can say is that you should ask to your ISP for a contact form mail code. Different host services could has different restrictions.
With this said, the content of your message is assigned in the variable $text, so you should add all the info you need to that variable to be sent.
I hope this helps
Reply to this Discussion! Login or Sign Up