Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
How to display $name Input that a user submitted in a form within a $alert when user pushes the submit button?

I am stuck and hoping someone can help.

I am trying to get the user's input (their $name) to show in the $alert'' when user submit form. Example: User types in to the form the following: ** Name: Joe , Tel: XXX.XXX.XXXX , Email: Joe@example.com *** and pushes submit.

-- page refreshes and says. "Message sent Joe, thank you for contacting us!"

$mail->send();
     $alert = <div class="alert-success">'
                     <span>Message sent $name, thank you for contacting us!</span> 
                    </div>'; 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to fix your typos, like this:

$mail->send();
     $alert = '<div class="alert-success">'.
                     '<span>Message sent '.$name.', thank you for contacting us!</span>'. 
                    .'</div>'; 

Now that you have a template in $alert you will need to make sure that you display it. The simplest way to do so is to echo it, like

echo $alert;

But you may need to display it somewhere else than the current position. Also, PHP is a template language as well, so in some environments you can do something like

$mail->send(); ?>
     <div class="alert-success">
                     <span>Message sent <?php echo $name; ?>, thank you for contacting us!</span> 
                    </div>
<?php
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda