PHP and Javascript - E-mail when label is clicked

Asked

Viewed 51 times

1

I have a form on my page, and part of it can be printed when clicked on a Print label:

<label id="printEvento" class="textDescricaoSobre font13" style="cursor: pointer">IMPRIMIR EVENTO</label>

Then another label can give the user the option to send this part of the form by email:

<label name="enviaEmail" class="textDescricaoSobre font13" style="cursor: pointer">ENVIAR POR E-MAIL</label>

However, I am not able to create the code (either in PHP or Javascript or both together) that sends this email and let you know that the sending happened through an alert. Actually, the alert is possible, but only in Javascript.

How can I do it? I use the Phpmailer library together?

  • You are using an HTML element that natively has no events associated with it, so you must necessarily use javascript to manipulate the click event in these Abels

  • For your code you want to send the data with or without refresh of the page?

  • @Adrianoluz preferred without the refresh. But it can be with also, if there is no way.

  • 1

    No refresh. In this case you will need to use ajax, by chance you are using jquery?

  • @Adrianoluz For now not. But I’ve used in other sites. How can I do?

  • 1

    Why instead of using <label> you do not use <form>? So you can use buttons to send the data without the need to link scripts

  • @Adrianoluz OK, as it is a form in two parts, I divided each one into a form and exchanged the label for an input. I will continue here, thanks.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.