Jump to content

Submit Forms On-line


mystified
 Share

Recommended Posts

I've been checking into the two methods of submitting on-line forms. The first and easiest of course being via email. I coded my page that way only to find out that Opera doesn't support it. It works in IE though. :evil:

 

The other being via cgi. I spent three hours this morning using google and couldn't find one decent site that explained how this methods works. Help?

 

TIA

Link to comment
Share on other sites

you mean like a "send me an email" page ???

do you have php running , coz I can right something pretty quickyl that will email something to you, if thats what you want.

<?



$title="LOUDAS.COM :: CONTACT";

$title2="Contact :: paul(at)loudas.com";

include("header.php");



// Where to send to?

$email = "paul@loudas.com";



// The subject of the e-mail you get if the form subject has been supplied:

if($subject=="") {

       $subject = "You've got mail from http://loudas.com";

       }

// Thank you message

function ShowThanks($firstname, $lastname, $subject, $from, $message, $REMOTE_HOST, $REMOTE_ADDR)

   {

   global $title2;

   ?>

   <!--//  Main Page Heading -->

   <div class="page-heading"><?=$title2?></div>

   <p class="general-text">

        

   </p>

   <div class="coding-text">

       <span class="coding-text">Thank You. This is the message that was sent</span>

       <br />

       <?

       echo "n$firstname $lastname wrote:n<br />$messagen<br /><br />---------n<br />Came from host: $REMOTE_HOSTn<br />IP Adress: $REMOTE_ADDRn<br />Email Address: $from";

       ?>

   </div>

   <?

   }



$nofirstname = "Your Firstname is required";

$nolastname = "Your Lastname is required";

$nofrom = "Your Email address is required";

$wrongmail = "You've filled in an incorrect Email address, try {your name}@your_internet_provider.com";

$nomessage = "You haven't filled in a message";



function makeTheForm()

   {

   global $era, $erb, $erc, $erd, $ere, $nofirstname, $nolastname, $nofrom, $wrongmail, $nomessage, $HTTP_POST_VARS, $title2;

   ?>

   <!--//  Main Page Heading -->

   <div class="page-heading"><?=$title2?></div>

   <div class="form">

       <form action="contact.php" method="post">

               <fieldset>

                       <legend>Name</legend>

                       <label for="firstname"<? if($era) { echo " class="form-error" title="$nofirstname""; } ?>>

                               First Name:

                               <input name="firstname" id="firstname" value="<?=$HTTP_POST_VARS[firstname]?>" />

                       </label>

                       <label for="lastname"<? if($erb) { echo " class="form-error" title="$nolastname""; } ?>>

                               Last Name:

                               <input name="lastname" id="lastname" value="<?=$HTTP_POST_VARS[lastname]?>" />

                       </label>

               </fieldset>

               <fieldset>

                       <legend>Subject</legend>

                       <label for="subject">

                               Subject:

                               <input name="subject" id="subject" value="<?=$HTTP_POST_VARS[subject]?>" />

                       </label>

               </fieldset>

               <fieldset>

                       <legend>Your Email Address</legend>

                       <label for="from"<? if($erc) { echo " class="form-error" title="$nofrom""; } elseif($erd) { echo " class="form-error" title="$wrongmail""; } ?>>

                               Email Address:

                               <input name="from" id="from" value="<?=$HTTP_POST_VARS[from]?>" />

                       </label>

               </fieldset>

               <fieldset>

                       <legend<? if($ere) { echo " class="form-error" title="$nomessage""; } ?>>Type your message here</legend>

                       <label for="message" id="message-label">

                               <span class="invisible"><input type="hidden" name="send" value="ok" /></span>

                               <textarea name="message" id="message" rows="10" cols="55"><?=$HTTP_POST_VARS[message]?></textarea>

                               <span class="form-buttons"><button type="submit" name=" Send Email ">Send Email</button>

                                  <button type="reset" name=" Clear Form " onclick="LALink('LAcontact');">Clear Form</button></span>

                       </label>

               </fieldset>

       </form>

   </div>

<?

   }



if ($send == "ok") {

       if ($firstname == "") {

               $ok = "false";

               $era = 1;

       }

       if ($lastname == "") {

               $ok = "false";

               $erb = 1;

       }

       if ($from == "") {

               $ok = "false";

               $erc = 1;

       }

       if ($from != "") {

               if (!eregi( "^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $from)) {

                       $erd = 1;

                       $ok = "false";

               }

       }

       if ($message == ""){

               $ok= "false";

               $ere = 1;

       }

       if ($ok != "false"){

               mail("$email", "$subject","$firstname $lastname wrote:n$messagenn---------nCame from host: $REMOTE_HOSTnIP Adress: $REMOTE_ADDRnEmail Address: $from", "From: $firstname $lastname <$from>nReply-To: $firstname $lastname <$from>nSender: $firstname $lastname <$from>");

               ShowThanks($firstname, $lastname, $subject, $from, $message, $REMOTE_HOST, $REMOTE_ADDR);

       }

       elseif ($ok == "false") {

               makeTheForm();

       }

}

else {

       makeTheForm();

}



include("footer.php");

?>

Link to comment
Share on other sites

you mean like a "send me an email" page ???

do you have php running , coz I can right something pretty quickyl that will email something to you, if thats what you want.

Now your just showing off. :cheeky:

Link to comment
Share on other sites

If you want to submit data through an online form then you need to expand your knowledge.

 

Basically, you can have a form which contains a field which is posted to a server of some sort. E.g. php or asp, or some other kind of server.

 

The html doc can have a form description

 

<form method="post" action="log.con" target="main" name="highlight" onmouseover="highlightButton('start')" onmouseout="highlightButton('end')">

 

and also a field

 

<input type="text" name="pacedate" size="12" value="<%=thedate %>">

 

In my code, I'm referencing theDate, giving it a value. When I generate the serve to the html page, it fills in the contents between the <% %>. After the form is posted (by some user action), the form values are available for the server to process.

 

So to make it this simple. You need a server as code if you want to do dynamic processing of html or processing of submitted forms.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...