Page 1 of 1

PHP coding

Posted: Wed Mar 18, 2009 1:35 pm
by Spida48
:cry: Hi I am a very new newbie starting out with PHP I have searched everywhere trying to find a php code FromMail at least one that I can understand so that I can follow what is going on. I am trying to put a form on a page with only 5 fields, but I just can't get the hang of it. Is there anyone out there that can give me a guide as to where I can find this. The ones that I have found you need to have programming knowledge to even start to understand it. As I said I am a very new newbie :?

Re: PHP coding

Posted: Wed Mar 18, 2009 1:55 pm
by php_east
Spida48 wrote:The ones that I have found you need to have programming knowledge to even start to understand it. As I said I am a very new newbie :?
but it *is* programming. you are programming the browser to receive inputs from the user, then send it across to the server, and then receive it in the server and then do someting with it. i just don't see how that can be acomplished without programming.

Re: PHP coding

Posted: Wed Mar 18, 2009 2:33 pm
by Spida48
:( Sorry you missed my point. I am aware that php is programming - I just meant that some of the tutorials are written in such a way - so technical - that for someone wthout any programming knowledge in the first place, it is almost impossible to understand.

Re: PHP coding

Posted: Wed Mar 18, 2009 4:02 pm
by php_east
ah, so i did, sorry. would gladly help make one if you cannot find a good non technical one.

Re: PHP coding

Posted: Wed Mar 18, 2009 4:25 pm
by Spida48
You are a life saver! I have spent all day searching the internet, trying to find a script that I could customise. From what I have seen so far unless you are pretty clued up on php you are stuck with what form fields the programmer chooses to use.
I only need 5 fields. From, telephone number, Favourite Song To Be Played, Dietary Requirements, Reply. The submit button to be 'send reply' . Subject of the form to appear on the email to be "Wedding Invitation Reply".

If there is any way in which you can help, I would be eternally grateful. Many thanks for your quick response. :D

Re: PHP coding

Posted: Wed Mar 18, 2009 4:26 pm
by Spida48
Sorry should have added this is to go into an html page which will have text before the form goes in. Is this a problem?

Re: PHP coding

Posted: Wed Mar 18, 2009 4:36 pm
by php_east
no, but i am a little confused, because the fields you are talking about, is html.

if all this is going to go out as an email, after the user fills in the form and click send, then the php portion is perhaps something like 3-4 lines. and i have seen excellent examples posted on this forum on how to send email using phpmail.

so lets break it down into two parts, html and php.
are you ok with making the html form ? then getting it from there into email is quite easily done.

Re: PHP coding

Posted: Wed Mar 18, 2009 6:30 pm
by Spida48
Hi I have no problem with the html. It's just how to get the form to send, so it goes without opening up an email program. Please see rough doc attached - when you click on the 'send reply' button it just goes and arrives in the recipients mail box.

Re: PHP coding

Posted: Wed Mar 18, 2009 6:42 pm
by DevGiven
Spida48 wrote:Hi I have no problem with the html. It's just how to get the form to send, so it goes without opening up an email program. Please see rough doc attached - when you click on the 'send reply' button it just goes and arrives in the recipients mail box.
no doc attached

Re: PHP coding

Posted: Wed Mar 18, 2009 6:45 pm
by William
DevGiven wrote:
Spida48 wrote:Hi I have no problem with the html. It's just how to get the form to send, so it goes without opening up an email program. Please see rough doc attached - when you click on the 'send reply' button it just goes and arrives in the recipients mail box.
no doc attached
The image you see is the doc he's talking about.

Re: PHP coding

Posted: Thu Mar 19, 2009 8:06 am
by Spida48
Sorry I'm not sure what you mean - no doc attached - I sent it as a jpeg image and I can see it on the post? :?

Re: PHP coding

Posted: Thu Mar 19, 2009 4:35 pm
by Spida48
Hi is there anyone out there that can help me with this problem. I only have five simple fields on the form and I need it so that when you click on 'send' or 'submit' it send the information to my email. PLEASE I NEED HELP. :banghead:

Re: PHP coding

Posted: Fri Mar 20, 2009 1:39 am
by php_east
here is an example.
http://www.php-scripts.com/php_diary/122899.php3

there are other better examples perhaps, but the most significant point is that
to send the form to email is quite easily done.

this is the php insruction that does it...

Code: Select all

mail($to, $subject, $contents, $from_header);
the variables $to, $subject etc are all that is obtained from you/your form. so in your case, the details such as Tel no, Fav Song and the rest should all be packed into the variable $contents. the entire PHP can be on the same form, you would then have a PHP driven HTML form

example....

FILE email.php ( yes, you need to make this file, and put your form in it )

Code: Select all

 
<?php
 
>
YOUR HTML FORM with action = email.php
<?php
 
some codes to prepare the email here
 
if (isset($to))
{
mail($to, $subject, $contents, $from_header);
}
 
the "some codes to prepare the email here" is the programing part. i know this is mind boggling for the first time, but that is how it is done. when the user clicks send, it sends the form values to your server looking for the file email.php, where your form is, but this time it is filled with values the user puts into the form, and so the program email.php sends the email.

that's it.