Hi everyone!
First post here, looking for some help. (I already used the search function!)
Some background info: I am starting my own company, a Law Firm, and designing its web site.
I am using Dreamweaver CS6 to create it.
I want to include two contact forms on my site, a legal advice one and another one to be used for general feebback. I have read everythig I could get my hands on about creating forms with dreamweaver and PHP but I can’t get the first one to work. (I have not created the second one yet)
At the moment I am running XAMP on my computer for testing purposes and I have configured a local server in dreamweaver.
This is the [B]form code
[code=php]<form action=”procesarconsulta.php” method=”post” enctype=”application/x-www-form-urlencoded” name=”Consulta” target=”new” id=”Consulta” dir=”ltr” lang=”es” onSubmit=”MM_validateForm(‘nombre’,”,’R’,’email’,”,’RisEmail’,’direccion’,”,’R’,’codigopostal’,”,’RisNum’,’Texto de la consulta’,”,’R’);return document.MM_returnValue”>
<table width=”724″ height=”117″ border=”0″ align=”center”>
<tr>
<td><label for=”nombre2″>Nombre </label>
<input type=”text” name=”Nombre” id=”nombre”></td>
<td><label for=”Email”>Email </label>
<input type=”text” name=”Email” id=”email”></td>
</tr>
<tr>
<td><label for=”Dirección”>Dirección </label>
<input type=”text” name=”Dirección” id=”direccion”></td>
<td><label for=”Código Postal”>Código Postal</label>
<input name=”Código Postal” type=”text” id=”codigopostal” maxlength=”5″></td>
</tr>
</table>
<p> </p>
<table width=”200″ border=”0″ align=”center”>
<tr>
<td> </td>
</tr>
<tr>
<td><p>
<label for=”Texto de la consulta”>Introduzca su consulta aquí</label>
</p>
<p>
<textarea name=”Texto de la consulta” cols=”104″ rows=”25″ id=”Texto de la consulta”></textarea>
</p></td>
</tr>
</table>
<p>
<input type=”submit” name=”enviar” id=”enviar” value=”Enviar mi consulta”>
<p>
<input name=”redirect” type=”hidden” id=”redirect” value=”http://localhost/paginaweb/Inicio.html”>
</p>
<p> </p>
</form>
an the [B]validation script
[code=php]<script type=”text/javascript”>
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors=”,args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!=””) {
if (test.indexOf(‘isEmail’)!=-1) { p=val.indexOf(‘@’);
if (p<1 || p==(val.length-1)) errors+=’- ‘+nm+’ must contain an e-mail address.n’;
} else if (test!=’R’) { num = parseFloat(val);
if (isNaN(val)) errors+=’- ‘+nm+’ must contain a number.n’;
if (test.indexOf(‘inRange’) != -1) { p=test.indexOf(‘:’);
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+=’- ‘+nm+’ must contain a number between ‘+min+’ and ‘+max+’.n’;
} } } else if (test.charAt(0) == ‘R’) errors += ‘- ‘+nm+’ is required.n’; }
} if (errors) alert(‘The following error(s) occurred:n’+errors);
document.MM_returnValue = (errors == ”);
} }
</script>
And this is the PHP file called “procesarconsulta” (process inquiry in English)
[code=php]<title>procesar consulta</title>
<?php
echo $_REQUEST (“nombre”);
echo $_REQUEST (“direccion”);
echo $_REQUEST (“email”);
echo $_REQUEST (“codigopostal”);
?>
After clicking the submit ([I]enviar mi consulta
Fatal error: Function name must be a string in C:xampphtdocspaginawebprocesarconsulta.php on line 3
And here is where I am stuck.
What is the way forward to make it work?
Thanks a lot for your help!