/    Sign up×
Community /Pin to ProfileBookmark

Are My Issets And &s Correct ?

Php Mates,

I have built an html form where atleast one of the input fields must be filled. If not one filled atleast then show error.

I tried these ways but none of them work:

[code]
<?php
//Required PHP Files.
include ‘config.php’; //Required on all webpages of the site.
//Check if User is already logged-in or not. Get the login_check() FUNCTION to check.
if (login_check() === FALSE)
{
//Redirect User to Log-in Page immediately.
//header(“refresh:0; url=home.php”);
header(“location:login.php”);
exit();
}
if ($_SERVER[‘REQUEST_METHOD’] == “POST”)
{
//Step 2: Check User submitted details.

//Check if User made any inputs or not.
if (!isset($_POST[“one”]) &
!isset($_POST[“two”]) &
!isset($_POST[“three”]) &
!isset($_POST[“four”]) &
!isset($_POST[“five”]))
{
echo “not ISSET”;
echo “You must atleast make an input in one field”;
}
else
{
echo “ISSET”;
echo “”; //How to show the ISSET one here ? (The field that has been filled in).
}
}
?>
<form method=”post” action=””>
<p align=”left”><h2>QuickLink Submission Form</h2></p>
<div class=”form-group”>
<p align=”left”><label>One:</label>
<input type=”url” name=”one” autocorrect=off value=”<?php if(isset($_POST[‘one’])) { echo htmlentities($_POST[‘one’]); }?>”></p>
</div>
<div class=”form-group”>
<p align=”left”><label>Two:</label>
<input type=”url” name=”two” autocorrect=off value=”<?php if(isset($_POST[‘two’])) { echo htmlentities($_POST[‘two’]); }?>”></p>
</div>
<div class=”form-group”>
<p align=”left”><label>Three:</label>
<input type=”url” name=”three” autocorrect=off value=”<?php if(isset($_POST[‘three’])) { echo htmlentities($_POST[‘three’]); }?>”></p>
</div>
<div class=”form-group”>
<p align=”left”><label>Four:</label>
<input type=”url” name=”four” autocorrect=off value=”<?php if(isset($_POST[‘four’])) { echo htmlentities($_POST[‘four’]); }?>”></p>
</div>
<div class=”form-group”>
<p align=”left”><label>Five:</label>
<input type=”url” name=”five” autocorrect=off value=”<?php if(isset($_POST[‘five’])) { echo htmlentities($_POST[‘five’]); }?>”></p>
</div>
<p align=”left”><button type=”submit” class=”btn btn-default” name=submit”>Submit!</button></p>
</form>
</div>
</body>
</html>
[/code]

get error:

Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in C:xampphtdocstestsettings.php on line 27

Q1. What is wrong ?

Line 27 is this:

[code]
echo “You must atleast make an input in one field”;
[/code]

Ok. Making another attempt ….

[code]
<?php
//Required PHP Files.
include ‘config.php’; //Required on all webpages of the site.
//Check if User is already logged-in or not. Get the login_check() FUNCTION to check.
if (login_check() === FALSE)
{ 
//Redirect User to Log-in Page immediately.
//header(“refresh:0; url=home.php”);
header(“location:login.php”);
exit();
}
if ($_SERVER[‘REQUEST_METHOD’] == “POST”)
{
//Step 2: Check User submitted details.

//Check if User made any inputs or not.
if (!isset($_POST[“one”]) &
!isset($_POST[“two”]) & 
!isset($_POST[“three”]) &
!isset($_POST[“four”]) &
!isset($_POST[“five”]))
{
echo “not ISSET”;
echo $_POST[“one”];
echo $_POST[“two”];
echo $_POST[“three”];
echo $_POST[“four”];
echo $_POST[“five”];
}
else
{
echo “ISSET”;
echo “”; //How to show the ISSET one here ? (The field that has been filled in).
}
}
?>

<form name “settings_form” method = “post” action=”” enctype = “multipart/form-data”>
<p align=”left”><h2>QuickLink Submission Form</h2></p>
<div class=”form-group”>
<p align=”left”><label>One:</label>
<input type=”url” name=”one” autocorrect=off value=”<?php if(isset($_POST[‘one’])) { echo htmlentities($_POST[‘one’]); }?>”></p>
</div>
<div class=”form-group”>
<p align=”left”><label>Two:</label>
<input type=”url” name=”two” autocorrect=off value=”<?php if(isset($_POST[‘two’])) { echo htmlentities($_POST[‘two’]); }?>”></p>
</div>
<div class=”form-group”>
<p align=”left”><label>Three:</label>
<input type=”url” name=”three” autocorrect=off value=”<?php if(isset($_POST[‘three’])) { echo htmlentities($_POST[‘three’]); }?>”></p>
</div>
<div class=”form-group”>
<p align=”left”><label>Four:</label>
<input type=”url” name=”four” autocorrect=off value=”<?php if(isset($_POST[‘four’])) { echo htmlentities($_POST[‘four’]); }?>”></p>
</div>
<p align=”left”><button type=”submit” class=”btn btn-default” name=submit”>Submit!</button></p>
</form>

[/code]

I get error:
Notice: Undefined index: one in C:xampphtdocsfollowing_browserWORKINGCOMPLETEsettings.php on line 28

Notice: Undefined index: two in C:xampphtdocstest.php on line 29

Notice: Undefined index: three in C:xampphtdocstest.php on line 30

Notice: Undefined index: four in C:xampphtdocstest.php on line 31

Notice: Undefined index: five in C:xampphtdocstest.php on line 32

Q2. Have I got my issets and my &s correct to achieve what I want ? If not, then care to show another way with a code sample.

Do bare in mind that, I want php to give error if atleast one input field is not filled out of the five.

Thanks!

to post a comment
PHP

16 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmOct 13.2018 — Have you found any of these exact lines with the errors and tried to interpret what is wrong? I can't find them. Maybe you can?

Plus - try and figure out how to avoid mixing in all this php logic with your html code. It's a mess to read and a mess to edit and a bigger mess to maintain down the road. You should do all of your php code before beginning any html output. Things that have to be built from code should be stored into php vars and then those vars can be inserted into your mass html output are where they need to be. MUCH SIMPLER AND EASIER TO READ AND MAINTAIN.
Copy linkTweet thisAlerts:
@rootOct 13.2018 — What is this page you posted called?

It doesn't look like a settings file to me, the error says the problem is in settings.php, is this file settings.php? If so then you need to be looking at code in and around the reported error as errors could exist further up the script, onething I would suggest is to stop staggering }
else
{

and use }else{, its less ambiguity as the parser may if it gets its reading wrong, thing that the else
{
mixed up with a previous if clause, I have seen weirder parser errors before now.

So for clarity, use braces and be clear as to what if (condition){ statement they belong to or foreach($something as $akey=&gt;$avalue){ which loop, often the reported line error has nothing to do with the actual error.
Copy linkTweet thisAlerts:
@site-developerauthorOct 13.2018 — @root#1596778

It is actually called:

C:xampphtdocsfollowing_browserWORKINGCOMPLETEsettings.php on line 28

But, on my post, I was supposed to edit to the following like I did on the other lines but I missed it:

C:xampphtdocstestsettings.php on line 28

Did not want you guys reading a lengthy path.

Anyway, even with your braces structure suggestion, I still get error on NotePad:

Parse error: syntax error, unexpected '}' in C:xampphtdocstestsettings.php on line 29

(Again, have edited the path in this post). ?

Line 29:
<i>
</i> } else {


Note the "if(!isset" has been changed to "if(empty" and the "&" changed to "&&" now but still same error.

<i>
</i>&lt;?php

//Required PHP Files.
include 'config.php'; //Required on all webpages of the site.

//Check if User is already logged-in or not. Get the login_check() FUNCTION to check.
if (login_check() === FALSE)
{
//Redirect User to Log-in Page immediately.
//header("refresh:0; url=home.php");
header("location:login.php");
exit();
}

$user = $_SESSION["user"];

if ($_SERVER['REQUEST_METHOD'] == "POST")
{
//Step 2: Check User submitted details.

<i> </i>//Check if User made any inputs or not.
<i> </i>if (empty($_POST["one"]) &amp;&amp;
<i> </i> empty($_POST["two"]) &amp;&amp;
<i> </i> empty($_POST["three"]) &amp;&amp;
<i> </i> empty($_POST["four"]) &amp;&amp;
<i> </i> empty($_POST["five"])) {
<i> </i>
<i> </i> echo "not ISSET";  
<i> </i>} else {
<i> </i> echo "SET";
<i> </i>}
}
?&gt;

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;?php echo "$social_network_name";?&gt; Settings Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class ="container"&gt;

&lt;?php
//Error Messages.
if (isset($_SESSION['error']) &amp;&amp; !empty($_SESSION['error'])) {
echo '&lt;p style="color:red;"&gt;'.$_SESSION['error'].'&lt;/p&gt;';
}
?&gt;

&lt;?php
//Session Messages.
if (isset($_SESSION['message']) &amp;&amp; !empty($_SESSION['message'])) {
echo '&lt;p style="color:red;"&gt;'.$_SESSION['error'].'&lt;/p&gt;';
}
?&gt;

&lt;?php
//Clear Registration Session.
function clear_settings_session()
{
//Clear the User Form inputs, Session Messages and Session Errors so they can no longer be used.
unset($_SESSION['message']);
unset($_SESSION['error']);
unset($_POST);
exit();
}
?&gt;

&lt;form method="post" action=""&gt;
&lt;p align="left"&gt;&lt;h2&gt;QuickLink Submission Form&lt;/h2&gt;&lt;/p&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;One:&lt;/label&gt;
&lt;input type="url" name="one" autocorrect=off value="&lt;?php if(isset($_POST['one'])) { echo htmlentities($_POST['one']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Two:&lt;/label&gt;
&lt;input type="url" name="two" autocorrect=off value="&lt;?php if(isset($_POST['two'])) { echo htmlentities($_POST['two']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Three:&lt;/label&gt;
&lt;input type="url" name="three" autocorrect=off value="&lt;?php if(isset($_POST['three'])) { echo htmlentities($_POST['three']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Four:&lt;/label&gt;
&lt;input type="url" name="four" autocorrect=off value="&lt;?php if(isset($_POST['four'])) { echo htmlentities($_POST['four']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Five:&lt;/label&gt;
&lt;input type="url" name="five" autocorrect=off value="&lt;?php if(isset($_POST['five'])) { echo htmlentities($_POST['five']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p align="left"&gt;&lt;input type="submit" class="btn btn-default" name="submit" value = "submit"&gt;Submit!&lt;/button&gt;&lt;/p&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


Tell me, atleast I got the Submit button code correct this time based on your suggestion in one of my other threads:
<i>
</i>&lt;input type="submit" class="btn btn-default" name="submit" value="submit"&gt;
Copy linkTweet thisAlerts:
@site-developerauthorOct 13.2018 — @ginerjm#1596776

Ok. For me to actually understand what you are saying, how-about you edit the following which is now working so I can get a picture in my head what you really are suggesting ?
<i>
</i>I deleted line 29 and  retyped it and error is gone! How come ? Everything working as expected!
[code]
} else {


Anyway, is my submit button ok or not ?
<i>
</i>&lt;?php

//Required PHP Files.
include 'config.php'; //Required on all webpages of the site.

//Check if User is already logged-in or not. Get the login_check() FUNCTION to check.
if (login_check() === FALSE)
{
//Redirect User to Log-in Page immediately.
//header("refresh:0; url=home.php");
header("location:login.php");
exit();
}

$user = $_SESSION["user"];

if ($_SERVER['REQUEST_METHOD'] == "POST")
{
//Step 2: Check User submitted details.

<i> </i>//Check if User made any inputs or not.
<i> </i>if (($_POST["one"]) == "" &amp;&amp;
<i> </i> ($_POST["two"]) == "" &amp;&amp;
<i> </i> ($_POST["three"]) == "" &amp;&amp;
<i> </i> ($_POST["four"]) == "" &amp;&amp;
<i> </i> ($_POST["five"])) {
<i> </i>
<i> </i> echo "All fields are empty!";
<i> </i> } else {
<i> </i> echo "Atleast one field has been filled";
<i> </i> }
}
?&gt;

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;?php echo "$social_network_name";?&gt; Settings Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class ="container"&gt;

&lt;?php
//Error Messages.
if (isset($_SESSION['error']) &amp;&amp; !empty($_SESSION['error'])) {
echo '&lt;p style="color:red;"&gt;'.$_SESSION['error'].'&lt;/p&gt;';
}
?&gt;

&lt;?php
//Session Messages.
if (isset($_SESSION['message']) &amp;&amp; !empty($_SESSION['message'])) {
echo '&lt;p style="color:red;"&gt;'.$_SESSION['error'].'&lt;/p&gt;';
}
?&gt;

&lt;?php
//Clear Registration Session.
function clear_settings_session()
{
//Clear the User Form inputs, Session Messages and Session Errors so they can no longer be used.
unset($_SESSION['message']);
unset($_SESSION['error']);
unset($_POST);
exit();
}
?&gt;

&lt;form method="post" action=""&gt;
&lt;p align="left"&gt;&lt;h2&gt;QuickLink Submission Form&lt;/h2&gt;&lt;/p&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;One:&lt;/label&gt;
&lt;input type="url" name="one" autocorrect=off value="&lt;?php if(isset($_POST['one'])) { echo htmlentities($_POST['one']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Two:&lt;/label&gt;
&lt;input type="url" name="two" autocorrect=off value="&lt;?php if(isset($_POST['two'])) { echo htmlentities($_POST['two']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Three:&lt;/label&gt;
&lt;input type="url" name="three" autocorrect=off value="&lt;?php if(isset($_POST['three'])) { echo htmlentities($_POST['three']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Four:&lt;/label&gt;
&lt;input type="url" name="four" autocorrect=off value="&lt;?php if(isset($_POST['four'])) { echo htmlentities($_POST['four']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
&lt;p align="left"&gt;&lt;label&gt;Five:&lt;/label&gt;
&lt;input type="url" name="five" autocorrect=off value="&lt;?php if(isset($_POST['five'])) { echo htmlentities($_POST['five']); }?&gt;"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p align="left"&gt;&lt;input type="submit" class="btn btn-default" name="submit" value ="submit"&gt;&lt;/p&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;


I'd be grateful, if you edit my code to demonstrate what you mean. Especially, note my session messages and session errors and the error echoes. I reckon I got my wires crossed here like missing a few lines and so care to fix my code for our learning purpose and demonstrate here how these session messages and session errors should be ?

Also, should I rid the spaces or not to:
<i>
</i>if (($_POST["one"])=="" &amp;&amp;
($_POST["two"])=="" &amp;&amp;
($_POST["three"])=="" &amp;&amp;
($_POST["four"])=="" &amp;&amp;
($_POST["five"])) {
Copy linkTweet thisAlerts:
@rootOct 14.2018 — ANY Unexpected item in programming is a result of a mismatrch somewhere in the script.

It is like suggestion that it should not be there or you have a opening brace within your code that is creating the bug elsewhere.

Thic can happen when you split things across lines.

So an if( somecondition )
{
as opposed to an if( somecondition ){

I would also swap out notepad for an ide or editor like Notepad++ as notepad on computers can introduce problems as the file may not be a properly formatted plain text file.

I have known people write code in wordpad and wonder why it doesn't work.

Try chaging your editor, you open the file and save as a completely plain text file that conforms to windows ASCII file type for plain text or whatever jargon it is now.

Then try the script.

I have had scripts that were given to me to work on to find that the editor environment was the actual problem.
Copy linkTweet thisAlerts:
@rootOct 14.2018 — &lt;form method="post" action=""&gt; to &lt;form name="geivemeaname" action="./whatpage_thisone.php" method="post" enctype="multipart/form-data"&gt;
Name things, apply appropriate attributes for the form.

Always make life easier for you, yse NAME, TYPE, VALUE as the main layout for input tags and tags that use name and those that have no name but id, put the id like the name after the main tag, makes it very easy to find certain inputs.

Been playing with what I can and it seems to be centred around the if( condition ){ ... } construct, if not constructed and each element nested properly, any overlap can lead to the problem of erroneous reporting and I believe that your issues are in that area at the moment.
Copy linkTweet thisAlerts:
@site-developerauthorOct 15.2018 — @root#1596786

Sorry Mr root!

I actually meant I use NotePad++.

I deleted line 29 and retyped it and error is gone! How come ? Everything working as expected!

I was told the reason why it did not work was:

"You likely inserted a non-breaking space somewhere in there. Probably with shift+space. PHP doesn't consider those like plain spaces so finding one will confuse it.".

Also, should I rid the spaces or not to:
<i>
</i>if (($_POST["one"])=="" &amp;&amp;
($_POST["two"])=="" &amp;&amp;
($_POST["three"])=="" &amp;&amp;
($_POST["four"])=="" &amp;&amp;
($_POST["five"])=="") {


from:
<i>
</i>if (($_POST["one"]) == "" &amp;&amp;
($_POST["two"]) == "" &amp;&amp;
($_POST["three"]) == "" &amp;&amp;
($_POST["four"]) == "" &amp;&amp;
($_POST["five"]) == "") {
Copy linkTweet thisAlerts:
@NogDogOct 15.2018 — The spaces won't matter around the == operator. It's a matter of coding style preference whether you leave them in or not. (I prefer to leave them in for easier readability.) Some people might even go so far as to line them up vertically to enhance readability even more:
[code=php]
if (
($_POST["one"]) == "" &&
($_POST["two"]) == "" &&
($_POST["three"]) == "" &&
($_POST["four"]) == "" &&
($_POST["five"]) == ""
) {
// do something
}
[/code]


(Because source code isn't just for the computer -- it's also for the people who have to maintain it.)
Copy linkTweet thisAlerts:
@site-developerauthorOct 15.2018 — @NogDog#1596810

My dear fellow NogDog,

I am getting error and so trying to fix it. But no matter how many curly braces I add or delete from each line I keep getting errors like these:

Parse error: syntax error, unexpected '||' (T_BOOLEAN_OR) in C:xampphtdocstestsettings_v1.php on line 20

Parse error: syntax error, unexpected '&' (T_BOOLEAN_OR) in C:xampphtdocstestsettings_v1.php on line 20

Do you mind helping me out here ?

Even others welcome!

[php]

//Check if User made any inputs or not. 

    if (($_POST["one"]) == "") || (($_POST["one"]) == " ")) && 

       ($_POST["two"]) == "") || (($_POST["two"]) == " ")) && 

       ($_POST["three"]) == "") || (($_POST["three"]) == " ")) && 

       ($_POST["four"]) == "") || (($_POST["four"]) == " ")) && 

       ($_POST["five"] == "") || (($_POST["five"]) == " ") && )) 

[/php]
Copy linkTweet thisAlerts:
@ginerjmOct 15.2018 — Just as a note - one doesn't need those parens around the variable names.

This:

($POST["two"]) == "") || (($POST["two"]) == " ")) &&

is not necessary and is just needless typing.

Try:

$POST["two"] == "" || $POST["two"] == " " &&

You will (in this case) need to put parens around the entire if condition but not around each var. Don't know where you "learned" to do that but it is not needed and just a lot of extraneous parens.
Copy linkTweet thisAlerts:
@site-developerauthorOct 15.2018 — NogDog,

Ok. Working:

<i>
</i>
//Check if User made any inputs or not. 
    if ((($_POST["one"]) == "" || ($_POST["one"]) == " ") &amp;&amp; 
       (($_POST["two"]) == "" || ($_POST["two"]) == " ") &amp;&amp; 
       (($_POST["three"]) == "" || ($_POST["three"]) == " ") &amp;&amp; 
       (($_POST["four"]) == "" || ($_POST["four"])== " ") &amp;&amp; 
       (($_POST["five"]) == "" || ($_POST["five"]) == " ")) 
    { 

Copy linkTweet thisAlerts:
@NogDogOct 15.2018 — You can make it a bit clearer by leveraging the trim() function, so you don't have to look for that space, e.g.:
[code=php]
if (
trim($POST["one"]) === "" &&
trim($POST["two"]) === "" &&
trim($POST["three"]) === "" &&
trim($POST["four"]) === "" &&
trim($POST["five"]) === ""
) {
// whatever...
}
[/code]


But, you could D.R.Y. things up with a function, and call it as needed:
[code=php]
function someFieldSet(Array $haystack, Array $needles)
{
$someFieldSet = false;
foreach($needles as $key) {
if(isset($haystack[$key]) and trim($haystack[$key]) !== '') {
$someFieldSet = true;
break;
}
}
return $someFieldSet;
}

// sample usage:
if !someFieldSet($_POST, array('one', 'two', 'three', 'four', 'five')) {
// handle nothing set error
}
[/code]
Copy linkTweet thisAlerts:
@site-developerauthorOct 15.2018 — @NogDog#1596815

I was gonna ask following. But, you already answered my question.Your 2nd example is best but it is adv

stuff and I'm still a beginner. ?

But, trying to use trim instead. Need help:
<i>
</i>if (trim($_POST["one"]) == "" &amp;&amp;
trim($_POST["two"]) == "" &amp;&amp;
trim($_POST["three"]) == "" &amp;&amp;
trim($_POST["four"]) == "" &amp;&amp;
trim($_POST["five"]) == "")
{


Get error:

Parse error: syntax error, unexpected 'echo' (T_ECHO) in C:xampphtdocstestsettings_v1.php on line 32

Is ok:
<i>
</i>if (trim($_POST["one"]) == "" &amp;&amp;
trim($_POST["two"]) == "" &amp;&amp;
trim($_POST["three"]) == "" &amp;&amp;
trim($_POST["four"]) == "" &amp;&amp;
trim($_POST["five"]) == "")
{
Copy linkTweet thisAlerts:
@NogDogOct 15.2018 — There are no errors in the code you posted, so I suspect it's something after the { and before the call to echo.

`
Copy linkTweet thisAlerts:
@rootOct 16.2018 — trim() will not cause an error its likely that the string contains characters in there (whitespaces) maybe some binary or oddities that like a null character that will usually break any string.

So try dumping the output to see what the string actually looks like and is it in a form that you are expecting?
Copy linkTweet thisAlerts:
@rootOct 16.2018 — It could ba as simple as having Notepad save in to a text format that is not standard for the internet, Notepad++ can open and save different text standards.

I would also say that the source of your examples and information is not using plain text as the medium to display their examples and there are characters and formatting that you just can't see and this is breaking the script either through encoding of the file or characters in the script (whitespace types) that are beaking the sctipt.

I have had both scenarios happen, so I would check what NPP is set up for. If you turn on the hex for the script and see a BOM of EF BB BF then its UTF-8 type file, it needs to be Windows-1252 aka ANSI and if the page is saved as anything else, it may be the route of all your problems.

Last time I had problems like this was when I installed an editor on my Linux box and all code pages were, broken... it was the editor, a few changes later, batch saved a few items and re-uploaded, site functioned fine.
×

Success!

Help @site-developer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...