Highlighted

Trouble with a contact form...

New Here ,
Jun 06, 2018

Copy link to clipboard

Copied

Let me completely honest… I have no idea what I’m doing and I don´t know how to use Dreamweaver, however, I’m trying to do something that is (hopefully) very simple.

Here’s the problem: I recently changed my hosting provider and our contact form stopped working; someone in customer service explained to me (without success) why my php script doesn’t work with their servers. I told him I had no idea how to fix that, so, he was kind enough to give me a php and an index file with a contact form that works.

Next, I opened Dreamweaver, copied the new contact form over the original, replaced the php file in the server and, for some reason, it just doesn’t work. The website goes blank after I click "SEND".

Does anyone know what's going on? I thought this was just a simple copy-paste trick…

Thanks in advance!

Adobe Community Professional
Correct answer by Nancy OShea | Adobe Community Professional

The SEND button has no action. 

Action is in the <form> tag.

Compare the Host's form with yours and fix the differences in Code view.

TOPICS
Dreamweaver CC 2014, Learn Dreamweaver

Views

613

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Trouble with a contact form...

New Here ,
Jun 06, 2018

Copy link to clipboard

Copied

Let me completely honest… I have no idea what I’m doing and I don´t know how to use Dreamweaver, however, I’m trying to do something that is (hopefully) very simple.

Here’s the problem: I recently changed my hosting provider and our contact form stopped working; someone in customer service explained to me (without success) why my php script doesn’t work with their servers. I told him I had no idea how to fix that, so, he was kind enough to give me a php and an index file with a contact form that works.

Next, I opened Dreamweaver, copied the new contact form over the original, replaced the php file in the server and, for some reason, it just doesn’t work. The website goes blank after I click "SEND".

Does anyone know what's going on? I thought this was just a simple copy-paste trick…

Thanks in advance!

Adobe Community Professional
Correct answer by Nancy OShea | Adobe Community Professional

The SEND button has no action. 

Action is in the <form> tag.

Compare the Host's form with yours and fix the differences in Code view.

TOPICS
Dreamweaver CC 2014, Learn Dreamweaver

Views

614

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 06, 2018 0
LEGEND ,
Jun 06, 2018

Copy link to clipboard

Copied

Can you paste your form code from start <form> tag to end </form> tag and also the php code in the forum?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
New Here ,
Jun 06, 2018

Copy link to clipboard

Copied

Sure!

**This is the form code the hosting service gave me:

<form name="frmContacto" method="post" action="sendbymail.php">

<table width="500px">

<tr>

<td>

<label for="first_name">Nombre: *</label>

</td>

<td>

<input type="text" name="first_name" maxlength="50" size="25">

</td>

</tr>

<tr>

<td valign="top"">

<label for="last_name">Apellido: *</label>

</td>

<td>

<input type="text" name="last_name" maxlength="50" size="25">

</td>

</tr>

<tr>

<td>

<label for="email">Direccion de E-mail: *</label>

</td>

<td>

<input type="text" name="email" maxlength="80" size="35">

</td>

</tr>

<tr>

<td>

<label for="telephone">Numero de telefono:</label>

</td>

<td>

<input type="text" name="telephone" maxlength="25" size="15">

</td>

</tr>

<tr>

<td>

<label for="comments">Comentarios: *</label>

</td>

<td>

<textarea name="comments" maxlength="500" cols="30" rows="5"></textarea>

</td>

</tr>

<tr>

<td colspan="2" style="text-align:right">

<input type="submit" value="Enviar">

</td>

</tr>

</table>

</form>

**This is the PHP script the hosting service gave me:

<?php

if(isset($_POST['email'])) {

// Debes editar las próximas dos líneas de código de acuerdo con tus preferencias

$email_to = "contact@myemail.com";

$email_subject = "Contacto desde el sitio web";

// Aquí se deberían validar los datos ingresados por el usuario

if(!isset($_POST['first_name']) ||

!isset($_POST['last_name']) ||

!isset($_POST['email']) ||

!isset($_POST['telephone']) ||

!isset($_POST['comments'])) {

echo "<b>Ocurrio un error y el formulario no ha sido enviado. </b><br />";

echo "Por favor, vuelva atrás y verifique la información ingresada<br />";

die();

}

$email_message = "Detalles del formulario de contacto:\n\n";

$email_message .= "Nombre: " . $_POST['first_name'] . "\n";

$email_message .= "Apellido: " . $_POST['last_name'] . "\n";

$email_message .= "E-mail: " . $_POST['email'] . "\n";

$email_message .= "Teléfono: " . $_POST['telephone'] . "\n";

$email_message .= "Comentarios: " . $_POST['comments'] . "\n\n";

// Ahora se envía el e-mail usando la función mail() de PHP

$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' . phpversion();

@mail($email_to, $email_subject, $email_message, $headers);

echo "¡El formulario se ha enviado con exito!";

}

?>

**This is my original php script, that no longer works... aparently it must have my email in the script.

<?php /* Created on: 02/05/2007 */ ?>

<?php

$to = $_GET["Email"] . "@" . $_GET["Dominio"];

$from = $_GET["From"] . "@" . $_GET["Dominio"];

$correo = $_GET["Email"];

//Datos para procesar el correo

$respuesta = $_GET["Confirmacion"];

$from =  $_GET["Correo"];

$replyto = $_GET["ReplyTo"];

$subject = $_GET["Subject"];

//Servidor de correo del cliente. Siempre va mail.dominio por ejemplo: mail.syop.com.mx

//$server = "mail.inventsa.com";

$server = "mail.".$_GET["Dominio"]."";

//Variables que recibe de estilo

$nombre_empresa= $_GET["Empresa"];

$font = $_GET["font"];

$color_titulo = $_GET["c_tit"];

$background_titulo = $_GET["b_tit"];

$color_subtitulo = $_GET["c_stit"];

$background_subtitulo = $_GET["b_stit"];

//VALIDACIONES PARA TODOS LOS CAMPOS

//|| $server == "mail.sysop.com.mx"

if($server == "" ){

echo "Tienes un error en la forma de contacto, no has cambiado el servidor de correo.";

exit;

}

else if (  $_GET["Email"] == "" ||  $_GET["Dominio"] == "" || $subject == "" ||  $_GET["From"] == ""){

echo "No estas mandando los campos escondidos para procesar el correo. <br/>

Estos campos pueden ser Email, Dominio o From.";

exit;

}

else if ( $nombre_empresa == " " || $font == "" || $color_titulo== "" || $background_titulo== "" || $color_subtitulo== "" || $background_subtitulo== ""){

echo "No estas mandando todos los campos para personalizar el correo. <br/>

  Revisa los hiddens de tu forma de contacto.";

exit;

}

if($respuesta == ""){

echo "Tienes un error en la forma de contacto, falta mandar la confirmaci&oacute;n.";

exit;

}

//Se borran las variables que no queremos que imprima en el correo.

unset ($_GET['Enviar']);

unset ($_GET['Submit']);

unset ($_GET['Email']);

unset ($_GET['Dominio']);

unset ( $_GET["Confirmacion"]);

unset ($_GET["Empresa"]);

unset ($_GET["font"]);

unset ($_GET["c_tit"]);

unset ($_GET["b_tit"]);

unset ($_GET["c_stit"]);

unset ($_GET["b_stit"]);

//Headers que tiene que tener para mandar el correo en html.

  $headers = "From: $from\r\n" .

     "Content-Type: text/html; ".

       "charset=UTF-8; format=flowed\n".

       "MIME-Version: 1.0\n".

       "Content-Transfer-Encoding: 8bit\n ".

       "X-Mailer: PHP\n";

// Se tienen las variables en el arreglo $Get y se les asigna llave y valor para imprimir.

foreach ($_GET as $key => $value)

{

$body.= '

<tr class="fondo">

    <td width="16%" class="left"> '.$key.':</td>

    <td width="84%"> '.$value.'</td>

</tr>';

}

$mensaje= '

<html>

<head>

<title>----Forma de Contacto----</title>

<meta http-equiv="Content-Type"  content="text/html; charset=UTF-8"/>

<style type="text/css">

.ancho{

height:40px;

}

body{

font-family:Lucida Sans;

font-size:12px;

color:#646464;

}

.borderright{

border-right:medium;

border-right-width:medium;

border-right-color:#D3D3D3;

border-right-style:solid;

}

.borderbottom{

border-bottom:medium;

border-bottom-width:medium;

border-bottom-color:#D3D3D3;

border-bottom-style:solid;

}

.fondo{

background-color:#fff;

}

.left{

padding-left:30px;

font-weight:bold;

}

.subtitulo{

font-family:'.$font.';

font-size:14px;

color:'.$color_subtitulo.';

background-color:'.$background_subtitulo.';

padding-top:5px;

padding-left:20px;

text-align:center;

font-style:italic;

font-weight:bold;

}

.titulo{

font-family:'.$font.';

font-size:20px;

color:'.$color_titulo.';

padding-top:5px;

padding-left:20px;

background-color:'.$background_titulo.';

}

</style>

</head>

<body>

<table width="50%" border="0" cellpadding="0" cellspacing="2" class="borderright borderbottom">

  <tr>

    <td colspan="2" class="titulo ancho">'.$nombre_empresa.'</td>

  </tr>

  <tr>

    <td colspan="2" class="subtitulo">El Solicitante introdujo los siguientes campos </td>

  </tr>

    '.$body.'

<tr>

<td> </td>

<td align="right" style="font-size:12px; font-family:Times New Roman, Times, serif; color:#001a78;">APISA</td></tr>

</table>

</body>

</html>';

//Manda el correo

mail("$to", "$subject", "$mensaje", "$headers");

//Se hace un location hacia la p?na de respuesta que se env?como par?tro.

print "<script>document.location.href='$respuesta'</script>";

?>

<html>

<?php

print "Mail enviado exitosamente";

?>

</body>

</body>

</html>

**Hope its not a problem that its in spanish.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
LEGEND ,
Jun 06, 2018

Copy link to clipboard

Copied

You say that the form code and the php script that your hosting company gave you worked? Did you test the form and script yourself?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
New Here ,
Jun 06, 2018

Copy link to clipboard

Copied

Yes, they work. I placed the files in a separate folder, inside the server, to test them and I got the email.

But when I copy over the original contact form something goes wrong.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
LEGEND ,
Jun 06, 2018

Copy link to clipboard

Copied

TooManyQuestions  wrote

Yes, they work. I placed the files in a separate folder, inside the server, to test them and I got the email.

But when I copy over the original contact form something goes wrong.

Assuming you have NOT changed the code in the sendbymail.php file and you have uploaded it to the correct folder on your server then the problem must be with YOUR form code.

Can you post the form code you copied into YOUR page NOT the code sent to you by your hosting company. You have most likely made an error whilst copying and pasting. Better still if your form page is online could you post a link to it?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
New Here ,
Jun 06, 2018

Copy link to clipboard

Copied

This is the link for the form I'm having trouble with: APISA // Bienvenido

This is the form that the hosting service gave me: http://apisa400.com/testformulario/

I think there is something that is not pasting properly. For example, when I copied the form for the first time I noticed that the button was still calling the original script; so I changed that.... maybe there is something similiar going on.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
Adobe Community Professional ,
Jun 06, 2018

Copy link to clipboard

Copied

Your contact form's names must match those in your processing script.

EDIT:  first_name, last_name, email, telephone, etc....

Use the host's contact form and script as they gave it to you.  If that works on your contact page, you're 90% there.

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
New Here ,
Jun 06, 2018

Copy link to clipboard

Copied

I did check that... well I think i did... In the properties panel there is a text box called "NAME" and I just checked that matched with the php script.

I think the answer to this mistery is going to be something I should've known....

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
Adobe Community Professional ,
Jun 06, 2018

Copy link to clipboard

Copied

Compare the code in your contact form with the working form your host gave you.   I see several differences.

The working form contains this:

<form name="frmContacto" method="post" action="sendbymail.php">

<table width="500px">

Your contact page contains this which is not at all the same.

<form action="manda_mail.php" method='get'  id="form1" onsubmit="MM_validateForm('Nombre','','R','Comentarios','','R','CorreoElectronico','','RisEmail','','','');ret...">

  <table cellpadding="3" cellspacing="3" class="left" >

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
New Here ,
Jun 06, 2018

Copy link to clipboard

Copied

Oh... I see what your are saying... the site still has references to the original script.

Do you know if there's way to correct that using design mode? The only thing I did was to change the "Form Action" in the SEND Button and to make sure that the "Name" tag in each text box matched the new script.

Maybe I have to make the form from scratch?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
Adobe Community Professional ,
Jun 06, 2018

Copy link to clipboard

Copied

The SEND button has no action. 

Action is in the <form> tag.

Compare the Host's form with yours and fix the differences in Code view.

Nancy O'Shea, ACP
Alt-Web.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 06, 2018 0
New Here ,
Jun 07, 2018

Copy link to clipboard

Copied

Thanks! I ended up fixing this by pasting the code and not the form in design view.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 07, 2018 0