We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
PHP Form?
Comments
-
i think i got it working with
<form method="post" action="contactbusiness.php">
<p align="left">Your Name:
<textarea name="message" rows="1" cols="15"></textarea>
<br>
Business Name:
<textarea name="message" rows="1" cols="15"></textarea>
<br>
Category:
<textarea name="message" rows="1" cols="15"></textarea>
<br>
Phone Number:
<textarea name="message" rows="1" cols="15"></textarea>
<br>
Email:
<textarea name="message" rows="1" cols="15"></textarea>
<br>
Website:
<textarea name="message" rows="1" cols="15"></textarea>
</p>
<input type="submit">
</p>
</form>
That won't do. Now you're creating lot's of "fields" called message, when in reality, each one should have a different name.
e.g.
Phone Number:
<textarea name="phone_number" rows="1" cols="15"></textarea>
<br>
etc.
What I meant before was keep the original HTML code, but just include the one extra line at the end, but before the submit button:
<textarea name="message" rows="1" cols="15"></textarea>Russia is HERE0 -
hi vy
it didnt work after all
for the php form i have
<form method="post" action="contactbusiness.php"><?php
$to = "[EMAIL="enquiries@onethoughtpgd.co.uk"]enquiries@onethoughtpgd.co.uk[/EMAIL]";
$subject = "Business Directory Listing";
$email = $_REQUEST ;
$message = $_REQUEST ;
$busname = $_REQUEST;
$cat = $_REQUEST;
$phone = $_REQUEST;
$web = $_REQUEST;
$headers = "From: $email";
$sent = mail($to, $subject, $email, $message, $business_name, $category, $phone_number, $website, $headers) ;
if($sent)
{print "Your mail was sent successfully, please allow 2-3 working days for your information to be placed on the site."; }
else
{print "We encountered an error sending your mail"; }
?>
<br>
</form>
but im getting an error message saying
Warning: mail() expects at most 5 parameters, 9 given in /home/sites/thisisglossop.co.uk/public_html/BusinessDirectory/contactbusiness.php on line 259
We encountered an error sending your mail
ive checked line 259 and everything seems fine?I need a cig...
0 -
The line
$sent = mail($to, $subject, $email, $message, $business_name, $category, $phone_number, $website, $headers) ;
is the problem there. I'm not sure what it does exactly, but there's a maximum of 5 arguments and there's 9 of them there:
The only arguments you need are outlined here: http://uk2.php.net/function.mail
(see the examples at the bottom.)Russia is HERE0 -
is there no way round cos i need all 9 forms really on the site?
soooo annoying lol
hope im not keeping you awakeI need a cig...
0 -
I'm really out of my depth here, but I think the mail() command only really needs the arguments:
mail($to, $subject, $message, $headers);
And probably not $headers. The way around it I can see would be to make the $message include the other bits of text from the html form (i.e $message is made up of $_REQUEST + $_REQUEST + $_REQUEST etc. so that all of those bits of information come through in the main body of the message to you. Sorry, I don't know how to do this.
Probably best waiting for someone with more knowledge!Russia is HERE0 -
thanks anyway vyseyboy
youve been a good help!I need a cig...
0 -
If you're willing to play around, you could try this, but I'm trying to learn how to do this on-the-fly myself :eek::
<form method="post" action="contactbusiness.php"><?php
$to = "[EMAIL="enquiries@onethoughtpgd.co.uk"]enquiries@onethoughtpgd.co.uk[/EMAIL]";
$subject = "Business Directory Listing";
$email = $_REQUEST ;
$message = "$_REQUEST /n $_REQUEST /n $_REQUEST /n $_REQUEST /n $_REQUEST" ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully, please allow 2-3 working days for your information to be placed on the site."; }
else
{print "We encountered an error sending your mail"; }
?>
<br>
</form>Russia is HERE0 -
yeah... that is a big problem with the basic form in php... only supports a few fields...
i'll root around later tonight and see if i can find a proper php form that gives you a bit of a better scope..
never ever use spaces in anything you program btw...
M0 -
please delete asapI need a cig...
0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 351.3K Banking & Borrowing
- 253.2K Reduce Debt & Boost Income
- 453.8K Spending & Discounts
- 244.3K Work, Benefits & Business
- 599.5K Mortgages, Homes & Bills
- 177.1K Life & Family
- 257.8K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.2K Discuss & Feedback
- 37.6K Read-Only Boards