Buenas tardes comunidad.
Mi pregunta ya fue publicada el pasado 2016-12-02 bajo el titulo "porque php no reconoce los datos pasados por post" el asunto esta que las respuestas suministradas no resuelve mi problema.
Contextualizacion del problema
- No intento comunicarme con una base datos, mi itencion es tomar la informacion del formulario y enviarlo via correo electronico.
- Despues pasar noches y dias enteros en diferentes foros (ingles y espanol), y aplicado todas las posibles soluciones a cada tema directamente relacionado con mi problema, no he logrado solucionarlo.
- Tengo un formulario (HTML5) con el siguiente codigo:
<form action="https://ed-td.com/layout/connections/requestService.php" method="post" autocomplete="on" name="requestService" id="requestService" accept-charset="utf-8">
<div class="one_third first">
<label for="rsName">Name <span>*</span></label>
<input id="rsName" type="text" name="rsName" title="Your name..." placeholder="ex, Alan Doe" onkeyup="this.value=this.value.toUpperCase()" value="" size="22" required>
</div>
<div class="one_third">
<label for="rsEmail">Mail <span>*</span></label>
<input id="rsEmail" type="email" name="rsEmail" title="Your email address..." placeholder="ex, [email protected]" onkeyup="this.value=this.value.toLowerCase()" value="" size="22" required>
</div>
<div class="one_third">
<label for="rsPhone">Mobil <span>*</span></label>
<input id="rsPhone" type="tel" name="rsPhone" title="Your phone number contact..." placeholder="ex, 786-546-2345" onkeyup="this.value=this.value.toUpperCase()" pattern="[1-9]{3}-[0-9]{3}-[0-9]{4}" maxlength="12" value="" size="22" required>
</div>
<div class="one_third first">
<label for="rsBusiness">Business name <span>*</span></label>
<input id="rsBusiness" type="text" name="rsBusiness" title="Your business name... or I'm a homeowner" placeholder="ex, Alan Food Company" onkeyup="this.value=this.value.toUpperCase()" value="I'm a homeowner" size="22" required>
</div>
<div class="one_third">
<label for="rsUrl">Website</label>
<input id="rsUrl" type="url" name="rsUrl" title="Website name..." placeholder="ex, https://alan.com" onkeyup="this.value=this.value.toLowerCase()" value="" pattern="https?://.+" size="22">
</div>
<div class="one_third">
<label for="rsCR">Comment or Request <span>*</span></label>
<select id="rsCR" name="rsCR" title="Choose one..." size="1" required>
<option value="Request">Request</option>
<option value="Comment">Comment</option>
</select>
</div>
<div class="block clear">
<label for="rsComment">Your Comment/Request <span>*</span></label>
<textarea id="rsComment" name="rsComment" title="Your comment or request..." placeholder="Tell us what do you need, residential or commercial?... Or your comment about our solution...." onkeyup="this.value=this.value.toLowerCase(), checkTextArea(this.name, 1000)" cols="25" rows="10" maxlength="1000" onchange="regularShow('submitReCaptcha')" required></textarea>
</div>
<div><input id="rsType" type="hidden" name="rsType" value="Electronic Security solutions on Passive mode - ESPM®"></div>
<div id="submitReCaptcha" style="display: none;">
<div class="g-recaptcha" data-sitekey="publicKey" data-callback="enabledSubmit"></div>
<input id="requestInfo" type="submit" name="requestInfo" value="Submit Form" disabled>
<input id="resetInfo" type="reset" name="resetInfo" value="Reset Form">
</div>
-
El codigo PHP (8.4.4) es el siguiente:
<?php /* * Control key: "", * @Author key: "", * @Created on key: "", * @Project key: "ED&TD®", * @Lenguaje key: "PHP", * Subject key: "Design and Development", * Task key: "PHP code for send mail from the form", * Filename key: "requestService.php", * Sources key: "Ver 1", "requestService.php", "https://codeforgeek.com/google-recaptcha-tutorial/" */ // Variable for manipulation data from Form $rsName; $rsEmail; $rsPhone; $rsBusiness; $rsUrl; $rsCR; // Options: Request, Comment $rsComment; $rsType; // Engineering solution type // Variable for manipulation data from reCaptcha implementation $reCaptcha; $secretKey = "secretKet"; // Secret Key $ipAddress; $varRepository; $contentJSon; // Variable for manipulation data into code $rsProposalReques = "[email protected]"; // When rsCR = Request $rsWebmasterComment = "[email protected]"; // When rsCR = Comment $myemail; $subject; $email; $message; $headers; // Processing if(isset($_POST['requestService'])){ // code... echo '<h2>Thanks for posting comment</h2>'; $rsName = $_POST['rsName']; $rsEmail = $_POST['rsEmail']; $rsPhone = $_POST['rsPhone']; $rsBusiness = $_POST['rsBusiness']; $rsUrl = $_POST['rsUrl']; $rsComment = $_POST['rsComment']; $rsType = $_POST['rsType']; // Engineering solution type $rsCR = $_POST['rsCR']; // Options: Request, Comment if ($rsCR == 'Request') { // code... $myemail = $rsProposalReques; $email = $rsEmail; $headers = "From: ".$myemail."\nReply-To: ".$email; $subject = "Engineering solutions request from ".$rsName." - Type: ".$rsType." - Request via WebSite"; $message = "1. Lead info"."\r\n". " 1.1. Business name: ".$rsBusiness."\r\n". " 1.2. Business owner: ".$rsName."\r\n". " 1.5. Email: ".$rsEmail."\r\n". " 1.6. WebSite: ".$rsUrl."\r\n". " 1.7. Phone number: ".$rsPhone."\r\n"."\r\n". "2. Requested info"."\r\n". " 2.1. Engineering solution type: ".$rsType."\r\n". " 2.2. Requirements gathering: ".$rsComment."\r\n"."\r\n"; }else{ // code... $myemail = $rsWebmasterComment; $email = $rsEmail; $headers = "From: ".$myemail."\nReply-To: ".$email; $subject = "Comment from ".$rsName." - Comment via WebSite"; $message = "1. Customer info"."\r\n". " 1.1. Business name: ".$rsBusiness."\r\n". " 1.2. Business owner: ".$rsName."\r\n". " 1.5. Email: ".$rsEmail."\r\n". " 1.6. WebSite: ".$rsUrl."\r\n". " 1.7. Phone number: ".$rsPhone."\r\n"."\r\n". "2. Comment to post ->"."\r\n".$rsComment."\r\n"."\r\n"; } // Sending mail mail($myemail, $subject, $message, $headers); echo "<script language='JavaScript'> location.href = \"https://ed-td.com/pages/thanks.html\" </script>"; }else{ // code... echo "<script language='JavaScript'> location.href = \"https://ed-td.com/pages/spammer.html\" </script>"; } ?>
- El asunto esta en que cuando se quiere recuperar el valor en la variable mediante el metodo POST esta generando el siguiente error, para cada variable definida en el formulario:
WARNING: Undefined array key "variableName" on line "##"
Que hemos hecho
- Hemos validado con la funcion var_dump( $_POST ) y hemos encontrado que el archivo PHP no esta recibiendo la data que envia el formulario.
- Sabemos que el formulario invoca el archivo PHP sin problema, porque procesa el condicional del codigo cuando la funcion isset es falsa.
- Hemos renombrado los archivos, hemos reescrito el codigo utilizando algoritmos diferentes, hemos actualizado la version del PHP, hemos moficiado las configuraciones del servidor PHP. Cabe aclarar que este proyecto esta en produccion; y que sencillamente dejo de funcionar desde hace unos tres meses.
Solicitamos ayuda
Comunidad, agradecemos toda la ayuda que puedan brindarnos en la resolucion de este problema. En verdad, necesitamos solucionarlo. El sistema automatico de correo electronico de esta compania, ha dejado de funcionar. Ya entenderan cuan apremiados estamos.
Disclaimer
Solo hasta hoy, encontre este foro, motivo por el cual no lo habia pubicado, reitero; hemos visitado foros tanto en Ingles como en Espanol, y no hemos encontrado la respuesta.
Gracias de antemano.