How to stay on the same page

Asked

Viewed 592 times

-2

In a 20-page HTML project I would like to put a PHP form to capture emails in each of them. What command, after the alert, the internet user is on the same page where he signed up - and not the Contact page (the only one in PHP)?

    if(EnviarEmail($destino, $email, $assunto, $msg)){
        echo '<script type="text/javascript">
        alert("'.$nome.', sua mensagem foi enviada com sucesso!")
        window.location = "../contato.php";
        </script>';
  • Hello. Your question is not very clear. If you do not want to change to the "contact.php" page, why use it window.location = "../contato.php";? The "answer" to your question then would not simply be: "just take that line"?

  • Thank you, Luiz. If I take this line it hangs in the file that "treats data" (the one that checks if the @s are correctly typed).

  • Thanks for the edition, Luiz!

  • Not at all. But just look at how you are already receiving negativities. Your question is not at all clear. For example, no one but you knows what the "data file" is. Try to edit the question to correctly write the problem, use screenshots to illustrate, etc. This site is not a forum, okay? If you haven’t done it yet, do the [tour] and mainly read [Ask].

  • Okay, Luiz! My first time! I think I better put the full code. Follow:

1 answer

0

Removes this line

window.location = "../contato.php";
  • Thank you, Xeoon. That’s what I told Luiz. If I take this line, it returns (locks, actually) in the file that "treats data" (check if @ is ok).

  • Depending on how your files are arranged, you can add the redirect only in the file that "treats data", and the others are left without using. Specify the structure of your project in the question, so we can know what this file is, what the information flow is, and other methods of handling this code. Also add more code if possible may be useful.

  • Thank you, Jhonatan, thank you. I reiterated this more detailed question here: (https://answall.com/questions/135167/formul%C3%A1rio-de-contato-actualiz-na-mesma-p%C3%A1gina)

Browser other questions tagged

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