• 0

Creating an HTML Contact Form


Question

Hi everyone. I don't work in HTML very often at all, but I am working on a simple website presently and wanted to add a contact form, but our hosting is Windows, so php is not an option. So I was wondering if I was able to create a simple contact page in html. I've never attempted to do so before, and after searching online didn't find a way that this has been accomplished, so I wanted to ask on here.

So, what suggestions would those that are much more familiar with HTML than I have? Any help is greatly appreciated.

Thanks Again,

Link to comment
https://www.neowin.net/forum/topic/1133986-creating-an-html-contact-form/
Share on other sites

8 answers to this question

Recommended Posts

  • 0

there's no excuse to rely on the client to handle forms in this day and age. write a mailing script in whatever language your host does support.

Thanks everyone for your responses. I have windows hosting, so I could write something in C# as an example (That's what I use for desktop development).

I guess my question though would be how to do that... I know it's broad, but I've never done anything like that. Would I create the UI in the HTML document and then on Send button click somehow use the C# code? I'm very intrigued by your post, but I honestly don't understand how this would be accomplished. Like I said, I very infrequently do web work, so while sending an e-mail is no problem on the desktop, I am unsure of how to do that through an HTML page.

Thanks Again everyone for your help.

  • 0

Thanks everyone for your responses. I have windows hosting, so I could write something in C# as an example (That's what I use for desktop development).

I guess my question though would be how to do that... I know it's broad, but I've never done anything like that. Would I create the UI in the HTML document and then on Send button click somehow use the C# code? I'm very intrigued by your post, but I honestly don't understand how this would be accomplished. Like I said, I very infrequently do web work, so while sending an e-mail is no problem on the desktop, I am unsure of how to do that through an HTML page.

Thanks Again everyone for your help.

you'd do exactly the same as you would a PHP-based form. Have the HTML form POST to the server side script, and figure out how to read that POSTed data in the language of your choosing and process it from there.

  • 0

you'd do exactly the same as you would a PHP-based form. Have the HTML form POST to the server side script, and figure out how to read that POSTed data in the language of your choosing and process it from there.

Thanks everyone for all of your help. I think I'm definitely on the right track (I actually wasn't aware of POST). I've never done anything like this before, just basic html pages...

Here's what I have. I found an online tool that generates this, which I thought was pretty handy.

html:

<!-- Website Contact Form Generator -->

<!-- http://www.tele-pro.co.uk/scripts/contact_form/ -->

<!-- This script is free to use as long as you -->

<!-- retain the credit link -->

<form method="POST" action="/cgi-bin/contact.cgi">

Fields marked (*) are required

<p>Email From:* <br>

<input type="text" name="EmailFrom">

<p>Subject: <br>

<input type="text" name="Subject">

<p>Name:<br>

<input type="text" name="Name">

<p>Tel:<br>

<input type="text" name="Tel">

<p><input type="submit" name="submit" value="Submit">

</form>

<p>

<!-- Contact Form credit link -->

Created by <a target="_blank"

href="http://www.tele-pro.co.uk/scripts/contact_form/">Contact

Form Generator</a>

CGI (I changed the email address for this post only):

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);

use CGI qw(:standard);

print "Content-type: text/html \n\n";

# Website Contact Form Generator

# http://www.tele-pro.co.uk/scripts/contact_form/

# This script is free to use as long as you

# retain the credit link

# get posted data into local variables

$input = new CGI;

$EmailFrom = $input->param('EmailFrom');

$EmailTo = "email\@mysite.com";

$Subject = $input->param('Subject');

$Name = $input->param('Name');

$Tel = $input->param('Tel');

# validation

$validationOK=true;

if ($EmailFrom eq '') {$validationOK=false;}

if ($validationOK eq false) {

print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";

exit;

}

# prepare email body text

$Body .= "Name: ";

$Body .= "$Name";

$Body .= "\n";

$Body .= "Tel: ";

$Body .= "$Tel";

$Body .= "\n";

# send email

use Win32::OLE;

$ex = Win32::OLE->new('CDONTS.NewMail') or die "\nCDONTS error";

$ex->Send($EmailFrom,$EmailTo,$Subject,$Body);

# redirect to success page

print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";

But the error I get is:

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Which, O.K., that's no big deal, the post action is directing it to a file that's not there. But I've creating the cgi-bin directory, I've stuck the file in there, I've changed the path to another directory where I put the file. No matter what I do it can't find this file. So, I was wondering if anyone sees something that I'm missing... I figured this would work if the file was where it should be... ?

Thanks Again for all of the help. I really appreciate it.

This topic is now closed to further replies.
  • Posts

    • Well I've done a grand total of nothing, and it now clocks between 2010mhz and 1995mhz (stock is 1710mhz) and hovers around 80c, warmer than it used to, but tolerable clocks seem to have returned. Thanks for all the advice on this thread. Will review the evidence and make a choice.
    • Audacious 4.6.1 by Razvan Serea Audacious is a lightweight, open-source audio player that emphasizes simplicity, performance, and sound quality. Designed for Linux, Windows, and macOS, it supports a wide range of audio formats, internet radio streaming, and playlist management. Users can customize the interface with Winamp-style skins or modern themes, making it flexible for different preferences. Audacious also includes an equalizer, advanced audio effects, and a plugin system for extending functionality. Its low resource usage makes it especially suitable for older computers or users who value efficiency without sacrificing playback quality. Audacious key features: High audio quality – delivers clean, gapless playback with minimal distortion. Wide format support – plays MP3, FLAC, Ogg Vorbis, AAC, WAV, WMA, and more. Internet radio streaming – supports Shoutcast, Icecast, and other online streams. Winamp skin support – classic, nostalgic look for users who prefer the old-school style. Modern GTK-based interface – clean, simple UI with a more modern feel. Customizable themes – change appearance through skins and themes. Advanced playlist management – organize, save, and edit playlists with ease. Equalizer – fine-tune audio output with a built-in graphical equalizer. Audio effects – built-in DSP options like crossfade, replay gain, and more. Plugin system – extend functionality with additional components. File metadata support – displays and organizes music based on tags. Drag-and-drop support – quickly add songs or playlists. Global hotkey support – control playback without switching windows. Bit-perfect output modes – bypass system mixers for pure audio output. ReplayGain support – normalizes track loudness automatically. Cue sheet support – play entire albums from a single audio file with .cue. MPRIS2 integration – integrates with Linux desktop environments for media controls. Advanced resampling options – adjust playback quality with different resampler settings. Gapless playback – seamless transition between tracks encoded properly. Crossfade plugin – blend one song into the next smoothly. Last.fm scrobbling plugin – track listening history online. Remote control support – control Audacious via command-line or scripts. Lyrics plugin – display song lyrics if available. Alarm / timer plugin – start or stop playback at set times. SOX resampler plugin – high-quality resampling for audiophiles. Spectrum analyzer / visualization plugins – visual feedback while playing music. Headphone crossfeed effect – simulates speaker listening for headphones. Customizable buffer size – tweak latency and playback smoothness. Audacious 4.6.1 changelog: Use XDG cache dir to store temporary files (#1817) Accept embedded lyrics in more cases (#1818) Bump .so and plugin ABI versions retrospectively (#1819) Include Georgian translation (#1820) Fix build on systems using musl instead of glibc (#1823) Download: Audacious 4.6.1 | 48.2 MB (Open Source) Download: Portable Audacious 4.6.1 | 69.8 MB View: Audacious Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • I really wonder if this has to do with the built in VPN or "private DNS" of browsers that trip up legal requirements like cookie consent and Cloudflare (to avoid all the botnet attacks we get). And BTW some botnets still manage to get past Cloudflare, we are constantly having to tweak it to block malicious traffic that ultimately cause a DDoS.
  • Recent Achievements

    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
    • One Month Later
      AndreaB earned a badge
      One Month Later
    • One Month Later
      agatameier earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      +Edouard
      197
    3. 3
      PsYcHoKiLLa
      142
    4. 4
      ATLien_0
      89
    5. 5
      Steven P.
      80
  • Tell a friend

    Love Neowin? Tell a friend!