Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts

    i need some help on php

    Hi guys, i have a basic html knowledge and i dont know php at all. now i have a problem with my website where i want to make a simple order form,

    For HTML part :
    in a table prefix that contain,
    Name:
    Contact No.:
    Mailing Address:
    Postcode: State:
    Email:
    Item Code : <select><option>Item 1</option></select>

    i hope to get this kind of format.

    For php part :
    i hope the php can read the html content and send a e-mail to my (order@domain.tld) so i can read the request and follow up with the buyer.
    is it possible to make the e-mail send thru out using google app email instead of the webmail?

    I hope someone could help me out, cause i got no idea how to make it and i dont mind u guys give me some example and abit of info on the code so i can learn it also.

    a big thanks from me for thoose who help me and i will credit them on my forum

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    There are approaches available for you to follow, but I don't believe that the actual 'mail' function in PHP supports third party applications.
    That said, look into using the PEAR mailhandling classes. These should be more flexible and allow easy configurations for external hosts.
    To do this otherwise, you'll want to open a tls socket to the gmail servers on port 465 (I think its 465, check with the gmail settings). So that would be something like this:
    PHP Code:
    $errNo = -1;
    $error '';
    $sock fsockopen('tls://smtp.gmail.com'465$errNo$error); 
    Fire you're email down it using fwrite, and it should work. That being said, I don't have a secure environment to test with, so I can't tell you for certain that this will work.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts
    lazy,

    PHP is good for submitting forms like this. HTML really has nothing to do with it. The extension of the page really does not matter either, as far as I know. forms that are submitted by the POST method I would assume are usually order forms, but I don't know this for certain. When you make an HTML form with controls on it, the method of the form is usually POST. You just basically need to reference the controls, and use MAIL() to send a follow up email to the buyer when they submit your form.

  • #4
    Regular Coder
    Join Date
    Jan 2010
    Posts
    127
    Thanks
    9
    Thanked 0 Times in 0 Posts
    hi thanks for the reply, but what about other part? i dont have any .html or .php file here, i need some example of the html and php. so i could try make some edit and learn.
    thanks again

    EDITED :
    Code:
    <form method="post" action="contact.php"> 
    <table width="400" align=center bgcolor=#ffffff> 
    <tr><td width="150"><p>Division:</p></td><td width="250"><p><input type="checkbox" name="sendto" value="support@vivacenetwork.co.cc" checked="checked" />Support</input></p></td></tr> 
    <tr><td><p><font color=red>*</font> Name:</p></td><td><input size=30 name="Name"></td></tr> 
    <tr><td><p><font color=red>*</font> Contact No.:</p></td><td><input size=30 name="Contact No."></td></tr>
    <tr><td><p><font color=red>*</font> Mailing Address:</p></td><td><textarea name="Mailing Address" rows=3 cols=30></textarea></td></tr> 
    <tr><td><p><font color=red>*</font> Email:</p></td><td><input size=30 name="Email"></td></tr>
    <tr><td><p><font color=red>*</font> Item Code:</p></td><td><select><option>Item 1</option><option>Item 2</option></select> 
    </td></tr> 
    <tr><td colspan=2 align=center><input type=submit name="send" value="Submit"> <input type=reset value="Reset" /></td></tr> 
    <tr><td colspan=2 align=center><p><small>A <font color=red>*</font> indicates a field is required</small></p></td></tr> 
    </table> 
    </form>
    </body>
    php part
    PHP Code:
    <?php 
    $to 
    $_REQUEST['sendto'] ; 
    $from $_REQUEST['Email'] ; 
    $name $_REQUEST['Name'] ; 
    $headers "From: $from"
    $subject "Website Support"

    $fields = array(); 
    $fields{"Name"} = "Name"
    $fields{"Email"} = "Email"
    $fields{"Message"} = "Message"

    $body "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } 

    $headers2 "From: noreply@vivacenetwork.co.cc"
    $subject2 "Thank you for contacting us"
    $autoreply "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our forum at http://forum.vivacenetwork.co.cc";

    if(
    $from == '') {print "You have not entered an email, please go back and try again";} 
    else { 
    if(
    $name == '') {print "You have not entered a name, please go back and try again";} 
    else { 
    $send mail($to$subject$body$headers); 
    $send2 mail($from$subject2$autoreply$headers2); 
    if(
    $send
    {
    header"Location: http://vivacenetwork.co.cc/thankyou.htm" );} 
    else 
    {print 
    "We encountered an error sending your mail, please notify support@vivacenetwork.co.cc"; } 
    }
    }
    ?>
    i get this code at a website where it give tutorial how to make contact us, (sorry cant make credit cause i forget the site name)

    i wanted to edit become a order such as i said on above, but the php part i dont know how to edit and make it can read the html content.
    Last edited by lazyserv; 01-17-2010 at 05:42 AM. Reason: edited code


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •