Reply
Learning PHP
Old 04-30-2008, 07:44 PM Learning PHP
bakerc's Avatar
Penguins on toast

Posts: 1,454
Name: carl
Location: UK
Hi

I am trying to learn PHP for form mail (another forum member is kindly writting a php form for me but also need to learn myslef) - would the below code work (I currently have no way of testing it)

PHP Code:
<?php
 $name 
$_REQUEST['Name'} ;
 
$homePhone $_REQUEST['PhoneNo'] ;
 
$mobileNumber $_REQUEST['MobileNo'] ;
 
$email $_REQUEST['Email'] ;
 
$propertyValue $_REQUEST['PropVal'] ;
 
$AdvanceRequired $_REQUEST['LoanAmount'] ;
 
$CallaT $_REQUEST['callaT'] ;
  
mail"enq@mysite.co.uk""Enquiry Form Results",
  
header"Location: http://www.mysite/thank_you.html" );
?>
HTML Code:
<form id="form1" name="form1" method="post" action="sendmail.php">
         <label for="Name">Full Name</label>
         <input type="text" name="Name" id="Name" />
         <label for="PhoneNo">Home Telephone</label>
         <input type="text" name="PhoneNo" id="PhoneNo" />
         <label for="MobileNo">Mobile Phone</label>
         <input type="text" name="MobileNo" id="MobileNo" />
         <label for="Email">Email Address</label>
         <input type="text" name="Email" id="Email" />
         <label for="PropVal">Property Value</label>
         <input type="text" name="PropVal" id="PropVal" />
         <label for="LoanAmount">Loan Amount</label>
         <input type="text" name="LoanAmount" id="LoanAmount" />
         <label for="FinType">Finance Required</label>
         <select name="FinType" id="FinType">
            <option selected="selected">Please Select</option>
            <option value="mortgage">Mortgage</option>
            <option value="remortgage">Remortgage</option>
            <option value="secured">Secured Loan</option>
            <option value="debt_man">Debt Management</option>
            <option value="BTL">Buy to Let</option>
            <option value="commercial">Commercial</option>
            <option value="other">Other</option>
         </select>
         <label for="callaT">Best Time to Call</label>
         <select name="callaT" id="callaT">
               <option>Please Select</option>
               <option value="morning">Morning</option>
               <option value="afternoon">Afternoon</option>
               <option value="evening">Evening</option>
               <option value="any">Any time</option>
            </select>
            <input type="submit" name="submit" id="submit" value="Call me back" />
            <a href="javascript:newwindow()" ><br />
            Data Protection Statement</a></p>
      </form>
 
I know at the moment nothing is verified in teh form but would the above php email me the details from the form??

If it will not can yo please point out where I am going wrong.

Thanks.
__________________
Lifes as good as you make it...
www.bakerfinancial.co.uk

Last edited by bakerc : 05-01-2008 at 02:00 AM.
bakerc is offline
Reply With Quote
View Public Profile Visit bakerc's homepage!
 
When You Register, These Ads Go Away!
     
Old 05-01-2008, 01:04 AM Re: Learning PHP
addonchat's Avatar
Skilled Talker

Posts: 97
Name: Chris Duerr
$message doesn't appear to be set anywhere -- I'm guessing that is where you'll glue your (sanitized) data together?

The javascript at the bottom of the HTML code looks like you're using a function defined elsewhere I gather..

Aside from that, it looks like it would work, though the extra header field seems redundant unless you're using it in a mail server filter or something.

As-is, it looks like it will grab the form data, stick them in your (unused as of yet) variables, then shoot off a blank eMail to enq@mysite.co.uk Make sure to check the return value of mail()
__________________
Chris Duerr
AddonChat Java Chat Software
http://www.addonchat.com/ - Affiliate Program
addonchat is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 01:09 AM Re: Learning PHP
VirtuosiMedia's Avatar
Webmaster Talker

Posts: 604
I haven't tried this out yet, but there is a program called XAMP that supposedly will install Apache, PHP, and MySQL for you so you can run a test server on your computer. It's supposed to be pretty easy to install, so if you can get it to work, you can test your php that way.
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 05-01-2008, 02:07 AM Re: Learning PHP
bakerc's Avatar
Penguins on toast

Posts: 1,454
Name: carl
Location: UK
Thanks for the comments, the $message has been removed (above) (my mistake).

The header is where I want the site to send the client after the form submites, a thank you for the enquiry page.

I will have a look at XAMP thanks- will was going to install WAMP as I belive this will do the same thing dut was going to ask this another time (after I have looked at it properly). Does anyone know if WAMP will let me test php on my machine?

Thanks Again
__________________
Lifes as good as you make it...
www.bakerfinancial.co.uk
bakerc is offline
Reply With Quote
View Public Profile Visit bakerc's homepage!
 
Old 05-01-2008, 09:16 AM Re: Learning PHP
addonchat's Avatar
Skilled Talker

Posts: 97
Name: Chris Duerr
If you just need to test, I'd just get yourself a ready-to-run Linux or BSD VMWare image. It's nice to boot an entire operating system in a box on your machine and have access to everything it has to offer, not to mention that you can most likely download any open source distribution of the exact same platform you plan for the program to actually run on.

Get the VMWare Player at http://www.vmware.com/products/player/ then head over to http://www.vmware.com/appliances/ and do a search for LAMP, or MySQL, or PHP, etc..
__________________
Chris Duerr
AddonChat Java Chat Software
http://www.addonchat.com/ - Affiliate Program
addonchat is offline
Reply With Quote
View Public Profile
 
Old 05-01-2008, 12:20 PM Re: Learning PHP
capetek's Avatar
Extreme Talker

Posts: 229
Location: Massachusetts
XAMP rocks! i live by it
__________________
Anthony LeBoeuf
Cape-Tek IT Solutions
www.cape-tek.com
Great hosting at affordable pricing!
capetek is offline
Reply With Quote
View Public Profile Visit capetek's homepage!
 
Old 05-01-2008, 10:28 PM Re: Learning PHP
Novice Talker

Posts: 5
I agree. XAMP works very well
psalzmann is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 04:39 AM Re: Learning PHP
Average Talker

Posts: 15
xamp works well .it will install php,apache, mysql automatically. you can download from wampserver.com site. with out any cost. you can learn php from website w3schools.com it is best site to learn any language
__________________
Web Site Development

Free Templates
gazal is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 06:09 AM Re: Learning PHP
tripy's Avatar
Fetchez la vache!

Posts: 1,855
Name: Thierry
Location: In the void
Xamp works well, but it is different of a linux hosted server.

For example, the table names in mysql ar case sensitive on Linux, not on windows.
Meaning that a code working on xampp could break on linux if you use camel case in table definition, but forgot to in queries.

Second, you need to tweek the php.ini to send email, which is not the case on linux.

Third, some php extensions (very specific, true, but they exists) ar non existant on windows, like pcntl.
Or some are relatively old versions, that implement not always everything. I think of the XSLT extension in particular, which I had problem to make work on windows.

fourth, it's always good to have a life & death control over the server.
I remember me populous, and I like it
__________________
Listen to the ducky: "This is awesome!!!"


Last edited by tripy : 05-02-2008 at 06:11 AM.
tripy is offline
Reply With Quote
View Public Profile
 
Old 05-02-2008, 10:24 AM Re: Learning PHP
VirtuosiMedia's Avatar
Webmaster Talker

Posts: 604
Quote:
Originally Posted by tripy View Post
Xamp works well, but it is different of a linux hosted server.

For example, the table names in mysql ar case sensitive on Linux, not on windows.
Meaning that a code working on xampp could break on linux if you use camel case in table definition, but forgot to in queries.

Second, you need to tweek the php.ini to send email, which is not the case on linux.

Third, some php extensions (very specific, true, but they exists) ar non existant on windows, like pcntl.
Or some are relatively old versions, that implement not always everything. I think of the XSLT extension in particular, which I had problem to make work on windows.

fourth, it's always good to have a life & death control over the server.
I remember me populous, and I like it
That helps to know that. Thank you, sir.
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 05-02-2008, 11:39 AM Re: Learning PHP
bakerc's Avatar
Penguins on toast

Posts: 1,454
Name: carl
Location: UK
All seems a little complex, I will download and install xamp and see how I go.

Thanks guys.

Tried this and looks to complicated for what I know and getting the time learning how to use the software will be very nigh on impossible with everything else I have gonig on, will have to wait until I change hosts and do it that way.

Quote:
Make sure to check the return value of mail()
sorry, I may be having an off day but what do you mean...
__________________
Lifes as good as you make it...
www.bakerfinancial.co.uk

Last edited by bakerc : 05-02-2008 at 11:59 AM. Reason: add content
bakerc is offline
Reply With Quote
View Public Profile Visit bakerc's homepage!
 
Old 05-02-2008, 07:55 PM Re: Learning PHP
melanko's Avatar
Average Talker

Posts: 15
Wish I knew about XAMP before. I'm just using good ole` Apache/php/mysql. I didn't have a hard time getting them to work though fortunately.
melanko is offline
Reply With Quote
View Public Profile
 
Old 05-06-2008, 01:22 PM Re: Learning PHP
Novice Talker

Posts: 5
Name: Ali
pls i need help! i have xamp and dreamweaver8 installed on my computer however i dont know how to creat and connect database to my form. pls help me am to submit a final year project on this
alisource is offline
Reply With Quote
View Public Profile
 
Old 05-06-2008, 01:46 PM Re: Learning PHP
tripy's Avatar
Fetchez la vache!

Posts: 1,855
Name: Thierry
Location: In the void
I cannot think of anything more basic.
If you cannot make this at the end of your formation, you really need to stay in that course.

And learn to use google....
__________________
Listen to the ducky: "This is awesome!!!"

tripy is offline
Reply With Quote
View Public Profile
 
Old 05-06-2008, 02:58 PM Re: Learning PHP
Novice Talker

Posts: 6
Name: Scott
Yeah I am learning PHP right now and actually have written the majority of my first PHP site that I coded. It's interesting..

Anyway, I wanted to comment that XAMP is what I use. Since I'm used to cPanel, getting going was easy with the included PHPMyAdmin (which I am familiar with).

I also love the Xamp panel to disable and enable the Apache / MySQL servers only when I need them.

Highly recommended.
__________________
Web Hosting Reviews - See hosting reviews by customers.
VPS Reviews - Need a virtual private server account?
HostingDeals is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Learning PHP
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.19467 seconds with 13 queries