Application forms

Application forms

Post by Not-as-of-yet on Sat Feb 21, 2009 7:07 am
([msg=18346]see Application forms[/msg])

Hello folks!

Being the tecnomancer among my friends, they rely on me to fix most of there little computer problems. Well lately I have been asked to build a webpage for a dance school (Going well, thanks for asking, 30 students the first week!) and its almost at upload state.

There is just one last page that I'm stumbling on, that being the application form. I have it looking the way I want, but I'm no pro at JavaScript, and not sure how to get this to work.

Basicly, I want the people to enter details on this form and press a button that will send the information to my friends Email adress, no processing required, so I'm praying hard that JavaScript will do It, and I won't need to upload more script to the server.

Now that I have my form looking nice, how would I go about this?

And apart from that, any advice on good servers that are free and have minimal adds/most freedom in URL.
But soon, its only a matter of time.
User avatar
Not-as-of-yet
New User
New User
 
Posts: 19
Joined: Sat Feb 14, 2009 8:32 am
Blog: View Blog (0)


Re: Application forms

Post by Ninfa on Sun Feb 22, 2009 12:35 pm
([msg=18408]see Re: Application forms[/msg])

A client-side scripting language, such as JavaScript, is unable to send an email itself.
But there are loads of ways to go about it.

Why not simply use href to point out the email address with the subject.
Code: Select all
<a href="mailto:email@blah.org?subject=Application">


But oh well, if that is too unprofessional. There are several ways to go about it, but indeed you'll have to use server-side scripts to email. Or better yet, simply store the applications in a file on the server (could even make a little panel to access the apps!).

Check back in once you've decided exactly what you want over that and I'll try to be of some use ;)

On the other note, you mean web hosts? 110mb is excellent.
Ninfa
New User
New User
 
Posts: 16
Joined: Sun Feb 22, 2009 1:57 am
Location: Behind you.
Blog: View Blog (0)


Re: Application forms

Post by Not-as-of-yet on Mon Feb 23, 2009 5:47 am
([msg=18445]see Re: Application forms[/msg])

Yea, I know I could use the HTML option, but that required the user to have outlook express working, something not many people bother to do, so therefor unreliable.

I COULD go about setting up a program on the server, but that COULD (Havn't done this myself, so not sure) be tricky, and, like most programmers, unless I'm doing something for myself, I can get lazy. Apart from that, some servers ask for cash to upload said programs, and If I'm doing this for a freind, I don't want to dip into my own pocket....

But thanks for the advice....Mayby I should skip on the form for now, one day, if I can get my freind into paying for services (Because I know mine is without reward!) then I will swap to something good quality....
But soon, its only a matter of time.
User avatar
Not-as-of-yet
New User
New User
 
Posts: 19
Joined: Sat Feb 14, 2009 8:32 am
Blog: View Blog (0)


Re: Application forms

Post by cen on Mon Feb 23, 2009 6:42 am
([msg=18447]see Re: Application forms[/msg])

I use this code on my site...

Code: Select all
<form name=emailForm method=post action="<?php $PHP_SELF?>?sendMail=send">
<input type=hidden name=mailTo value="<?php echo("$receiver");?>">

<table border=0 width=600 height=476>
<tr>
   <td valign=middle align=center>
      <table width=350 height=400>
      <tr>
         <th align=left>
            Your Email: <br />
            Subject:
         </th>

         <td align=right>
            <input name=mailReplyTo size=25> <br />
            <input name=mailSubject size=35>
         </td>
      </tr>
      <tr height=110>
         <td>
         </td>
      </tr>
      <tr>
         <td valign=bottom align=center colspan=2>
            <textarea name=mailBody rows=5></textarea>
         </td>
      </tr>
      <tr>
         <th align=center colspan=2>
            <input type=submit value=Send name=submit> <input type=reset value=Clear name=reset>
         </th>
      </tr>
      </table>
   </td>

</tr>
</table>

</form>

<?php
function ErrorMessage($msg)
{   echo "<script>alert(\"Error: $msg\");history.go(-1)</script>";
}

function MyMail($mailParts)
{   $mailTo=$mailParts["mailTo"];
   $mailFrom=$mailParts["mailReplyTo"];
   $mailReplyTo=$mailParts["mailReplyTo"];
   $mailSubject=$mailParts["mailSubject"];
   $mailBody=$mailParts["mailBody"];

   if(empty($mailSubject)) ErrorMessage("Empty subject!");
   if(empty($mailBody)) ErrorMessage("Empty body!");

   $mailTo=str_replace(";", ",", $mailTo);
   $mailHeaders='';

   if(!empty($mailFrom)) $mailHeaders.="From: $mailFrom\n";
   if(!empty($mailReplyTo)) $mailHeaders.="Reply-to: $mailReplyTo\n";
   $mailSubject=stripslashes($mailSubject);
   $mailBody=stripslashes($mailBody);

   return mail($mailTo, $mailSubject, $mailBody, $mailHeaders);
}

function SendMail()
{   global $mailTo, $mailFrom, $mailReplyTo, $mailBody, $mailSubject;

   $mailTo='application-request@somesever.com';
   $mailParts["mailTo"]=$mailTo;
   $mailParts["mailFrom"]=$mailReplyTo;
   $mailParts["mailReplyTo"]=$mailReplyTo;
   $mailParts["mailSubject"]=trim($mailSubject);
   $mailParts["mailBody"]=$mailBody;

   if(!MyMail($mailParts))
      ErrorMessage("An unknown error occured while attempting to send email - '$mailSubject'.");
   else
      echo "<script>history.go(-2)</script>";
}

if(isset($sendMail))
   SendMail();
?>


I ripped this out of my contact page rather quickly - so there may be a bug or two somewhere - But basically, this IS what you want. Your server will need PHP and sendmail (both are likely available). Sendmail can also be substituted with another mailer I'm sure.

I'd just try copying this code and inserting it into a page, run it on your server and see how it works....

Don't forget to change application-request@somesever.com to the email address you want to receive the email...

Hope this helps
User avatar
cen
Experienced User
Experienced User
 
Posts: 77
Joined: Mon Jun 30, 2008 1:06 pm
Blog: View Blog (0)


Re: Application forms

Post by Not-as-of-yet on Wed Feb 25, 2009 10:26 pm
([msg=18687]see Re: Application forms[/msg])

Thanks! I'll try shredding that into lines of code and spewing out something decent....

Javascript is a silly language....They didn't put in a mail function because then programmers could use it to put together the email adresses of anybody that vists a site without there knowing, and use this list for mass spam, highly unethical and annoying.

But who the hell builds a ethics orintated programming language! THE FOOLS!
But soon, its only a matter of time.
User avatar
Not-as-of-yet
New User
New User
 
Posts: 19
Joined: Sat Feb 14, 2009 8:32 am
Blog: View Blog (0)



Return to Web Design

Who is online

Users browsing this forum: No registered users and 0 guests