How can I get Started?

  • 14 years ago
    Hello all,
       I am trying to do a form for the internet, where is I need to make this form go to the owner of the websites email address or CGI bin. can you reccommend some book to me so I can get started on this specific task?
          Thanks in advance.



  • 14 years ago

    Hi Ignotastic,
       Something like this should work for you. Read http://www.php.net/manual/en/function.mail.php for more infomation on PHP mail() function.

    --- index.html page ---
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>



    <form name="myform" method="POST" action="dosend.php">
      <table width="500" cellpadding="0" CELLSPACING="0">
        <TR>
          <TD>
            <FONT SIZE="2">Your name:<br>
            <input type="text" name="realname" size="18">               
            </font>                               
          </TD>
          <TD>
            Your e-mail address:<br>
            <input type="text" name="email" size="18">    
          </TD>
        </TR>
      </table><br/>
        Your message:<br/>
        <textarea rows="15" name="message" cols="50">text</TEXTAREA>
      </p>
      <p>
        <input type="submit" value="Send" name="submit">
                  
        <input type="reset" value="Clear All" name="B2">
      </p>
    </form>





















    </body>
    </html>


    --- dosend.php page ---

    <?php

    $headers = "Sender: {$_POST['email']} \r\n"; // needed some spam filter
    mail("
    [email protected]","Subject", $_POST['message'], $headers);

    ?>


    <br/>&nbsp; Thanks for e-mailing us.


  • 14 years ago
    Hi hnmedcom,
    you are giving the code correctly.
    But i am having a small doubt on mail function.
    in mail function you will send the to address,subject,message and from mailid.
    Here i need to send the from mail id and from name(your name) in your form in the headers.
    and i want to send some priority like normal,urgent,... also in the headers.
    How can i send all the information through headers.
    Please give the solution.








  • 14 years ago
    bool mail ( string $to, string $subject, string $message [, string $additional_headers [, string $additional_parameters]] )

    so far additional headers you call with the 4th parameter.

    Each header needs to be seperated by an end of line character "\n".

    $header="ReplyTo: [email protected]\n";
    $header.="Priority: High\n"// etc.








Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold