Jump to content

Need some help with MEW3 SP1


sanjoa

Recommended Posts

Hi, guys! I need some help. I've been "Googling" and I have found nothing relevant. I need to do a form for a website (a contac form). How do I do a contact form in Microsoft Expression Web 3 SP1? The hosting has CGI BIN enabled, so I configured formmail to work in it, but I need to do a form in that program.

Link to comment
Share on other sites


  • Replies 14
  • Views 1.2k
  • Created
  • Last Reply
LeetPirate

Hi, guys! I need some help. I've been "Googling" and I have found nothing relevant. I need to do a form for a website (a contac form). How do I do a contact form in Microsoft Expression Web 3 SP1? The hosting has CGI BIN enabled, so I configured formmail to work in it, but I need to do a form in that program.

Easy stuff. I will help you. :)

First check inside your cgi-bin folder on your webhost and see if you have a file named "cgiemail" then make sure the file has executable permissions. On a secure host, executable permission is only required for the user, not group or world, what this translates too is the file permission should be either, 100, 300, 500, 700. Server defaults may actually be 744 but if it is 777 then it suggests your server is not secure and therefore cgiemail may fail to send if your account tries to send it as "nobody". We will test that error later on.

The next thing you need is a template file which is a text file containing input variable names from the contact form code, the easiest way to not get confused with the file paths is to place the template.txt in the cgi-bin folder.

The input variables are placed inside square brackets. I will put an example of a template and a matching form code extract from a html page. If you want to use a required field you have to add the string "required_" to the input variable name. Take a look at the example code.

Template file.

From: [required_email]
To: [email protected]
Subject: [subject]
Sender Information
-------------------------------------------------

Name: [required_yourname]
Phone: [phone]
Fax: [fax]
-------------------------------------------------

Message or Question:

[required_message]






Form code from html file.

			<form action="http://www.yourdomain.com/cgi-bin/cgiemail/cgi-bin/template.txt" enctype="multipart/form-data" id="form">
<div class="box">
<div class="col_box_1">
Name: (*required)<br /><div class="div_input"><input name="required_yourname" type="text" value="" /></div>
E-mail: (*required)<br /><div class="div_input"><input name="required_email" type="text" value="" /></div>
Subject: <br /><div class="div_input"><input name="subject" type="text" value="" /></div>
Phone: <br /><div class="div_input"><input name="phone" type="text" value="" /></div>
Fax: <br /><div class="div_input"><input name="fax" type="text" value="" /></div>
</div>
<div class="col_box_2">Message: (*required)<br />
<textarea name="required_message" cols="72" rows="10"></textarea>
</div>
<div class="clear"></div>
</div>
<div class="div_links"><a class="link3" href="#" onclick="document.getElementById('form').reset()">reset</a> <a class="link3" href="#" onclick="document.getElementById('form').submit()">submit</a></div></form>

If you need more specific help you will need to paste the html form code from your contact page.

Link to comment
Share on other sites


thank you. but at my cgi-bin folder there's no other thing that FormMail.pl. and permissions are 775

Link to comment
Share on other sites


LeetPirate

thank you. but at my cgi-bin folder there's no other thing that FormMail.pl. and permissions are 775

formmail.pl is a perl script. I have used it before but not in a long time so I won't be able to help you with that right now. I don't think you need it because your contact form should be using cgiemail. I will upload the cgiemail script for you to place into your cgi-bin folder, after you upload the files, change the permissions to make it executable.

cgi.zip

Link to comment
Share on other sites


thanks. let my install it and I tell you

Link to comment
Share on other sites


I got a 500 Server error after trying to send the form completed

Link to comment
Share on other sites


LeetPirate

I got a 500 Server error after trying to send the form completed

Can you paste the entire error? Also for debugging purposes try changing the permissions on cgiemail and template.txt to 777 temporarily and see if you get the same error. If it still comes up then most likely the host is not allowing you to send emails as the user nobody, they do this to prevent spam. You could contact the tech support to get it working. This is assuming that all the code is correct. In the form you could test if the output is being generated by replacing the word cgiemail with cgiecho so the first part looks like this:

<form action="http://www.yourdomain.com/cgi-bin/cgiecho/cgi-bin/template.txt" enctype="multipart/form-data" id="form">

If you want me to test it you could paste the code you use along with the template.txt. If you directly inserted the code I provided above then the problem is most likely with the host or with file permissions because that code I took from one of my live sites that is working 100%, I just replaced the name of the actual domain.

If you don't mind my asking, what host are you using?

Link to comment
Share on other sites


Here's the code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" [url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]>
<html xmlns=http://www.w3.org/1999/xhtm">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>ConcepHost - Un nuevo concepto en hosting - Contacto</title>
</head>

<body>
<form action=[url="http://www.concephost.com.ar/cgi-bin/template.txt"]http://www.concephost.com.ar/cgi-bin/template.txt[/url] enctype="multipart/form-data" id="form">
<div class="box">
<div class="col_box_1">
Nombre: (*requerido)<br /><div class="div_input"><input name="required_yourname" type="text" value="" /></div>
E-mail: (*requerido)<br /><div class="div_input"><input name="required_email" type="text" value="" /></div>
Asunto: <br /><div class="div_input"><input name="subject" type="text" value="" /></div>
Telefono: <br /><div class="div_input"><input name="fax" type="text" value="" /></div>
</div>
<div class="col_box_2">Mensaje: (*requerido)<br />
<textarea name="required_message" style="width: 396px; height: 234px"></textarea>
</div>
<div class="clear"></div>
</div>
<div class="div_links"><a class="link3" href="#" onclick="document.getElementById('form').reset()">Limpiar</a> <a class="link3" href="#" onclick="document.getElementById('form').submit()">Enviar</a></div></form>
</body>

And the template.txt

De: [email_requerido]
A: [email="[email protected]"][email protected][/email]
Asunto: [asunto]
Informacion del remitente
-------------------------------------------------

Nombre: [tunombre_requerido]
Apellido:
Telefono: [telefono]
-------------------------------------------------

Mensaje o consulta:

[mensaje_requerido]

The host I use is Todos acá. Is from my country, Argentina.

Link to comment
Share on other sites


LeetPirate

Ok try this code and template.txt instead. I believe one of the problems was that you renamed the input variable names to Spanish in the template.txt file but it did not match the variable names in the html file. If you change the variable names you have to match them on both files. Since the variable names remain hidden I left them in English, I only translated the text that would be seen by the world.

Contact page HTML code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" [url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]>
<html xmlns=http://www.w3.org/1999/xhtm">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>ConcepHost - Un nuevo concepto en hosting - Contacto</title>
</head>

<body>
<form action="http://www.concephost.com.ar/cgi-bin/cgiemail/cgi-bin/template.txt" enctype="multipart/form-data" id="form">
<div class="box">
<div class="col_box_1">
Nombre: (*requerido)<br /><div class="div_input"><input name="required_yourname" type="text" value="" /></div>
E-mail: (*requerido)<br /><div class="div_input"><input name="required_email" type="text" value="" /></div>
Asunto: <br /><div class="div_input"><input name="subject" type="text" value="" /></div>
Telefono: <br /><div class="div_input"><input name="phone" type="text" value="" /></div>
</div>
<div class="col_box_2">Mensaje: (*requerido)<br />
<textarea name="required_message" cols="72" rows="10"></textarea>
</div>
<div class="clear"></div>
</div>
<div class="div_links"><a href="#" onclick="document.getElementById('form').reset()">Limpiar</a> <a href="#" onclick="document.getElementById('form').submit()">Enviar</a></div></form>
</body>

template.txt (place file in cgi-bin folder):

De: [required_email]
To: [email protected]
Asunto: [subject]
Información acerca del remitente
-------------------------------------------------

Nombre: [required_yourname]
Teléfono: [phone]
-------------------------------------------------

Mensaje o Pregunta:

[required_message]

Leave the "To" field in English.

For more advanced guides you could check the cgiemail user guide. cgiemail is an old method so if you still cannot get it working, I suggest you use a php contact script. 2 of my favourites are Reconn.us Contact Us php script and Xornic Contact Us php script.

The zip file I uploaded for you contains 2 files inside, "cgiemail" and "cgiecho", don't forget to extract the files from the zip and upload them to your cgi-bin folder, after you upload change their permissions to 755 to make it executable.

Link to comment
Share on other sites


again the same problem. at my host, only appears CGI-BIN folder, so I created the other folders

Link to comment
Share on other sites


LeetPirate

again the same problem. at my host, only appears CGI-BIN folder, so I created the other folders

You don't need to create any folders for this, the template.txt, cgiemail, cgiecho files go into the cgi-bin folder, the html file with the form code goes into the folder just above the cgi-bin folder. No folders need to be created for this.

Link to comment
Share on other sites


I've downloaded those PHP Scripts.They work so good. I don't know how to configure PHP.

I'd like to mail appears like

Contacto desde pagina web: 
1. Nombre :ConcepHost
2. E-mail:[email protected]
3. Telefono:156495015
3. Mensaje:hoola esta es una pruba

Instead of

Could you help me? (I'm using reccon.us scripts)

Link to comment
Share on other sites


again the same problem. at my host, only appears CGI-BIN folder, so I created the other folders

You don't need to create any folders for this, the template.txt, cgiemail, cgiecho files go into the cgi-bin folder, the html file with the form code goes into the folder just above the cgi-bin folder. No folders need to be created for this.

OK. No problem

Link to comment
Share on other sites


LeetPirate

I've downloaded those PHP Scripts.They work so good. I don't know how to configure PHP.

I'd like to mail appears like

Contacto desde pagina web: 
1. Nombre :ConcepHost
2. E-mail:[email protected]
3. Telefono:156495015
3. Mensaje:hoola esta es una pruba

Instead of

Could you help me? (I'm using reccon.us scripts)

Open the file contactus_a01.php in a text editor that will preserve the formatting like Notepad++, I believe Expression Web will do it as well. Check for this piece of code around line 65. I'm assuming you are using the a01 files here, if you are using a different number then the same rules apply just edit your appropriate file.

Look for the following set of lines:

		$msg="Contact us form completed:\n";
$msg.="1. Name :".$_POST['nume']."\n";
$msg.="2. E-mail:".$_POST['email']."\n";
$msg.="3. Web:".$_POST['website']."\n";
$msg.="3. Message:". $_POST['mesaj']."\n";

Try this code that adds in the windows compatible line break (just a \r\n instead of \n alone):

		$msg="Contact us form completed:\r\n";
$msg.="1. Name :".$_POST['nume']."\r\n";
$msg.="2. E-mail:".$_POST['email']."\r\n";
$msg.="3. Web:".$_POST['website']."\r\n";
$msg.="3. Message:". $_POST['mesaj']."\r\n";

Instead of using \n unix type line breaks we are going to test out xhtml line breaks, if it does not work then we will try html paragraph tags. so the new code should look like this:

		$msg="Contact us form completed:<br />";
$msg.="1. Name :".$_POST['nume']."<br />";
$msg.="2. E-mail:".$_POST['email']."<br />";
$msg.="3. Web:".$_POST['website']."<br />";
$msg.="3. Message:". $_POST['mesaj']."<br />";

OR you could try this:

		$msg="Contact us form completed:\n";
$msg.="<p>""1. Name :".$_POST['nume']."</p>";
$msg.="<p>""2. E-mail:".$_POST['email']."</p>";
$msg.="<p>""3. Web:".$_POST['website']."</p>";
$msg.="<p>""3. Message:". $_POST['mesaj']."</p>";

Last resort would be to try PHP_EOL but i don't really like this way, not sure how great it works either:

		$msg="Contact us form completed:" . PHP_EOL;
$msg.="1. Name :".$_POST['nume']. PHP_EOL;
$msg.="2. E-mail:".$_POST['email']. PHP_EOL;
$msg.="3. Web:".$_POST['website']. PHP_EOL;
$msg.="3. Message:". $_POST['mesaj']. PHP_EOL;

The most browser compliant way might be using the xhtml br tags, it works even on IE6.

Link to comment
Share on other sites


nice. thank you for your help. :notworthy:

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...