It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

I need some php help once again

Moderator: Malcolm

I need some php help once again

Postby Ash on Thu Jun 22, 2006 10:26 pm

What I want to do is to have a entry form so people can fill in details and a send button so it gets sent to my email. I know it can be done but don't know how. Any help would be great.
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby dazz_club on Fri Jun 23, 2006 12:03 am

Hi Ash,

So you would like a simple form that users have to complete and then press the send button to be sent to your email?

I`m a bit surprised you dont know this im sure you had helped me out previously.

anyway just for clarification visit this link, have a look at it and let me know if that is what you require and i will help you out. Its a simple questionnaire form.


http://www.liquid-crystal.com/B&H_questionnaire.html
User avatar
dazz_club
250+ Club
 
Posts: 313
Joined: Fri Jul 15, 2005 7:35 am
Location: Chester and Hull

Postby webmaster on Fri Jun 23, 2006 12:06 am

Check out my posts in this thread:
form-amp-e-mail-vt2142.html
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Ash on Fri Jun 23, 2006 12:56 am

Thanks I will take alook.
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby Ash on Fri Jun 23, 2006 1:02 am

I am such a noob on PHP and am clueless on Razz's post so here goes.

I am going to have the form so someone fills it out as an application to be affiliated then it get sent to my email but only if all the fields have text in. I also want it to close the window down within say 7/8 seconds if the user does not do it themselves.
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby webmaster on Fri Jun 23, 2006 7:56 am

The 7-8 second closedown should be done with JavaScript, and it will only work if your form is in a popup window.

There are some other ways of doing it too, but they're way to complicaded I guess. :)

Here's a code. you can change "Field 1", "Field 2" and up to "Field 5" in both places they appear. But do not change "field-1" to "field-5".

[php]<?php

if(isset($_POST['submit'])) {

$to = "your@mail.com";
$subject = "Subject of the mail you'll get."

$message = "Here are some info that was sent from your site:\n";

$message .= "\nField 1: " . $_POST['field-1'];
$message .= "\nField 2: " . $_POST['field-2'];
$message .= "\nField 3: " . $_POST['field-3'];
$message .= "\nField 4: " . $_POST['field-4'];
$message .= "\nField 5: " . $_POST['field-5'];

mail($to, $subject, $message);

echo "Your mail has been sent!";

} else { ?>

<form method="post">

Field 1: <input type="text" name="field-1" /><br />
Field 2: <input type="text" name="field-2" /><br />
Field 3: <input type="text" name="field-3" /><br />
Field 4: <input type="text" name="field-4" /><br />
Field 5: <input type="text" name="field-5" /><br />

<input type="submit" name="submit" value="send the mail" />

<?php } ?>[/php]
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Ash on Fri Jun 23, 2006 11:27 am

Ok it's in there and I decided to try it on myself but I never got a reply.
This is the code I used is it right:
[php]<?php

if(isset($_POST['submit'])) {

$to = "potnoodlerehabforme@googlemail.com";
$subject = "Subject of the mail you'll get."

$message = "Here are some info that was sent from your site:\n";

$message .= "\nField 1: " . $_POST['field-1'];
$message .= "\nField 2: " . $_POST['field-2'];
$message .= "\nField 3: " . $_POST['field-3'];
$message .= "\nField 4: " . $_POST['field-4'];
$message .= "\nField 5: " . $_POST['field-5'];

mail($to, $subject, $message);

echo "Your mail has been sent!";

} else { ?>

<form method="post">

Your name: <br /><input type="text" name="field-1" /><br />
Your websites name:<br /> <input type="text" name="field-2" /><br />
Your affiliates code:<br /> <input type="text" name="field-3" /><br />
Your email:<br /> <input type="text" name="field-4" /><br />
Why you want to become affiliated with me:<br /> <input type="text" name="field-5" width="100" height="100" /><br />

<input type="submit" name="submit" value="send the mail" />[/php]
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby webmaster on Fri Jun 23, 2006 11:42 am

Try this:

[php]<?php

if(isset($_POST['submit'])) {

$to = "potnoodlerehabforme@googlemail.com";
$subject = "Subject of the mail you'll get."

$message = "Here are some info that was sent from your site:\n";

$message .= "\nField 1: " . $_POST['field-1'];
$message .= "\nField 2: " . $_POST['field-2'];
$message .= "\nField 3: " . $_POST['field-3'];
$message .= "\nField 4: " . $_POST['field-4'];
$message .= "\nField 5: " . $_POST['field-5'];

mail($to, $subject, $message);

echo "Your mail has been sent!";

} else { ?>

<form method="post">

Your name: <br /><input type="text" name="field-1" /><br />
Your websites name:<br /> <input type="text" name="field-2" /><br />
Your affiliates code:<br /> <input type="text" name="field-3" /><br />
Your email:<br /> <input type="text" name="field-4" /><br />
Why you want to become affiliated with me:<br /><textarea name="field-5" style="width:100px;height:100px;"></textarea><br />

<input type="submit" name="submit" value="send the mail" />

</form>

}

?>[/php]
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Ash on Fri Jun 23, 2006 1:27 pm

Is it supposed to show a message that says that the email has been sent? if so it don't. Also may it not work because it's not been uploaded to a FTP host yet?
User avatar
Ash
1000+ Club
 
Posts: 1020
Joined: Wed Aug 03, 2005 6:10 pm
Location: England

Postby johneva on Fri Jun 23, 2006 2:30 pm

Yeah if it is not on a server with PHP installed yet then no it wont work yet. :)
Image
Only God Can Judge Me.
User avatar
johneva
500+ Club
 
Posts: 565
Joined: Sat Oct 29, 2005 1:16 pm
Location: Stafford, England

Next

Who is online

Users browsing this forum: No registered users and 0 guests