Notepad++ automatically opens links in the browser
Solved
Adri1infos
Posted messages
658
Status
Member
-
sebastien -
sebastien -
Hello,
I use Notepad++ to write a PHP page. In this page, there is a redirection:
Unfortunately, every time I open the page for editing (or refresh Notepad), it opens the link in my browser.
So in less than a minute, I have more than 20 Google tabs open.
This is very annoying.
Do you have any information/solutions to avoid this (I've checked the settings, etc.)?
Adri1infos
I use Notepad++ to write a PHP page. In this page, there is a redirection:
<meta http-equiv="refresh" content="0;url=https://www.google.fr/"/>
Unfortunately, every time I open the page for editing (or refresh Notepad), it opens the link in my browser.
So in less than a minute, I have more than 20 Google tabs open.
This is very annoying.
Do you have any information/solutions to avoid this (I've checked the settings, etc.)?
Adri1infos
1 answer
-
Hello,
It's normal for your browser to open that many pages, but why is that?
Your refresh is at zero
Then use Js, it's much better
EXAMPLE<html> <head> <script type="text/javascript"> function RedirectionJavascript(){ document.location.href="www.google.fr"; } </script> </head> <body onLoad="setTimeout('RedirectionJavascript()', 2000)"> <div>In 2 seconds you will be redirected to www.google.be</div> </body> </html>
At least here you're only doing one redirection.-
-
-
No problem, here is the original code. Basically, I'm retrieving data from an HTML form and writing it to a text file.
I couldn't set up a PHP redirect because I need to execute the page before doing the redirection. With the meta tag, no issue (even with refresh = 0), the PHP executes perfectly.<html> <head> <title>INDEX</title> <meta http-equiv="refresh" content="0;url=https://www.google.fr"/> </head> <body> <? // testing the variable declarations if (isset($_POST['nom']) && isset($_POST['prenom'])) { // displaying the results $_POST['nom'] = $nom; $_POST['prénom'] = $prénom; } if($fp = fopen("index.txt","a")){ /* opening the file for writing !this is line 17 */ fputs($fp, "\n"); // going to a new line fputs($fp, "name : $nom surname : $prénom"); // writing the name and surname to the file fclose($fp); } ?> </body> </html> -
Several mistakes are already visible
if (isset($_POST['nom']) && isset($_POST['prenom']))
Here is what you declare in the variables$_POST['prénom'] = $prénom;
replace with$_POST['prenom'] = $prenom;
Same hereputs($fp, "nom : $nom prénom : $prénom");
puts($fp, "nom : $nom prenom : $prenom");
Your field apparently is called prenom and not prénom
Otherwise, I don't see any explanation regarding the opening of the pages. It is not possible for your PHP to execute since your fields did not have the same prénom or prenom, as a choice I did not see the HTML -
-