121

Proper configuration of php-src with CLion IDE : PHPhelp

 6 years ago
source link: https://www.reddit.com/r/PHPhelp/comments/79hhky/proper_configuration_of_phpsrc_with_clion_ide/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Hi guys! Rookie here, I've been studying coding for just over 3 months, I need your help plz.

I'm doing a friends website for his wedding. I think I'm pretty much done except when submitting an RSVP, the email is not displaying all the information that was written in the contact form.

I got the PHP from Codepen and I changed some things to add more text fields to the contact form, Im thinking this is where I fucked up.

HTML:

               <form id="myForm" action="email.php" method="POST" name="contactform">
                    <div class="input-line">
                        
                        <input maxlength="50" name="first_name" class="input-name" id="first-n" type="text" required placeholder="Nombre"  /></p>
                        
                        <input maxlength="50" name="first_rut" class="input-name" id="first-r" type="text" required  placeholder="RUT" /></p>
                        
                        <input maxlength="50" name="second_name" class="input-name" id="second-n" type="text" requiredplaceholder="Nombre Acompañante"  /></p>
                       
                        <input maxlength="50" name="second_rut" class="input-name" id="second-r" type="text" required placeholder="RUT Acompañante" /></p>
                       
                        <input maxlength="30" name="telephone" class="input-name" id="phone" type="text" placeholder="Telefono" /></p>
                        
                        <input maxlength="80" name="email" class="input-name" id="emailadr" type="email" required placeholder="Email" /></p>
                    </div>
                        
                        <textarea cols="25" maxlength="1000" id="msg" name="comments" class="input-textarea" rows="6" placeholder="Cuentanos si tienes alguna restricción alimentaria o quieres dejar algun mensaje." ></textarea></p>
            
                        <button type="submit" id="submit" value="Enviar">Enviar</button>
                 </form>

PHP:

<?php
 
if(isset($_POST['email'])) {

    $email_to = "[email protected]";
 
    $email_subject = "Formulario Matrimonio";
 
    function died($error) {
 
        echo "<h1>Oops!</h1><h2>Parece que hay algún problema con el formulario                completado.</h2>";
 
        echo "<strong><p>Los siguientes elementos no están especificados correctamente.</p></strong><br />";
 
        echo $error."<br /><br />";
 
        echo "<p>Regrese al formulario y vuelva a intentarlo.</p><br />";
		echo "<p><a href='index.php'>Vuelve a la página inicial</a></p>";
        die();
	
    }
  
    $first_name = $_POST['first_name']; 
 
    $first_rut = $_POST['first_rut']; 

    $second_name = $_POST['second_name']; 
 
    $second_rut = $_POST['second_rut']; 
 
    $email_from = $_POST['email']; 
 
    $telephone = $_POST['telephone']; 
 
    $comments = $_POST['comments']; 
 
    $error_message = "";
 
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
 
    if(!preg_match($email_exp,$email_from)) {
 
    $error_message .= '<li><p>The completed e-mail address appears to be incorrect<p></li>';
 
  }
 
    $string_exp = "/^[A-Za-z .'-]+$/";
 
  if(!preg_match($string_exp,$first_name)) {
 
    $error_message .= '<li><p>Name appears to be wrong</p></li>';
 
  }
 
  if(strlen($comments) < 2) {
 
    $error_message .= '<li><p>Message appears to be incorrect</p></li>';
 
  }
 
  if(strlen($error_message) > 0) {
 
    died($error_message);
 
  }
 
    $email_message = "Form details are given below.\n\n";
 
     
 
    function clean_string($string) {
 
      $bad = array("content-type","bcc:","to:","cc:","href");
 
      return str_replace($bad,"",$string);
 
    }
 

    $email_message .= "Nombre: ".clean_string($first_name)."\n";
 
    $email_message .= "RUT: ".clean_string($first_rut)."\n";

    $email_message .= "Nombre Acompañante: ".clean_string($second_name)."\n";
 
    $email_message .= "RUT Acompañante: ".clean_string($second_rut)."\n";

    $email_message .= "Telephone: ".clean_string($telephone)."\n";
 
    $email_message .= "Email Address: ".clean_string($email_from)."\n";
 
    $email_message .= "Comments: ".clean_string($comments)."\n";
 
      
 

 
$headers = 'From: '.$email_from."\r\n".
 
'Reply-To: '.$email_from."\r\n" .
 
'X-Mailer: PHP/' . phpversion();
 
@mail($email_to, $email_subject, $email_message, $headers);  
 
?>
 
<h1>¡Gracias!</h1> <h2>Esperamos verte pronto</h2>

<?php
 
}
 
?>

And this is the info I'm getting in the email.

Nombre: Richard (but this name was actually written under "Nombre Acompañante"
RUT: BLANK
Nombre Acompañante: BLANK
RUT Acompañante: BLANK
Telephone:
Email Address: [email protected]
Comments: Nos vemos!

Doesn't actually say blank, I just filled that in.

Plz help, thank you!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK