PHP coding

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Spida48
Forum Newbie
Posts: 7
Joined: Wed Mar 18, 2009 1:30 pm

PHP coding

Post 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 :?
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: PHP coding

Post 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.
Spida48
Forum Newbie
Posts: 7
Joined: Wed Mar 18, 2009 1:30 pm

Re: PHP coding

Post 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.
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: PHP coding

Post by php_east »

ah, so i did, sorry. would gladly help make one if you cannot find a good non technical one.
Spida48
Forum Newbie
Posts: 7
Joined: Wed Mar 18, 2009 1:30 pm

Re: PHP coding

Post 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
Spida48
Forum Newbie
Posts: 7
Joined: Wed Mar 18, 2009 1:30 pm

Re: PHP coding

Post 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?
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: PHP coding

Post 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.
Spida48
Forum Newbie
Posts: 7
Joined: Wed Mar 18, 2009 1:30 pm

Re: PHP coding

Post 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.
Attachments
Very rough draft example
Very rough draft example
rsvp.jpg (21.25 KiB) Viewed 537 times
DevGiven
Forum Newbie
Posts: 7
Joined: Wed Mar 04, 2009 5:41 pm

Re: PHP coding

Post 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
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Re: PHP coding

Post 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.
Spida48
Forum Newbie
Posts: 7
Joined: Wed Mar 18, 2009 1:30 pm

Re: PHP coding

Post 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? :?
Spida48
Forum Newbie
Posts: 7
Joined: Wed Mar 18, 2009 1:30 pm

Re: PHP coding

Post 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:
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: PHP coding

Post 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.
Post Reply