Search
 
SCRIPT & CODE EXAMPLE
 

HTML

php if statement not working

** PHP code, put in HTML for no markup **

How is it not working? It could be multiple things, like below

1. Bad syntax
2. What you're using in the "if" statement might not actually be there.
3. Anything else



Answer 1.

Here's is an example of a bad syntax, using $abc = "abc" as the example. 

if($abc == ""){ /*do something*/ } else { /*do something*/ }

What you really should have is...
if(empty($abc)){ /*do something*/ } else { /*do something*/ }



Answer 2.

If you're using an if statement, you of course got to have what you're checking.
Its no good checking if $abc has the value of "abc", when $abc doesn't even exist.

Rather simple answers above, but I hope it helps. Mostly its bad syntax that causes these problems most of the time.
Comment

PREVIOUS NEXT
Code Example
Html :: animated dots 
Html :: devexpress aspxdatagridview set column alignment 
Html :: space animation html 
Html :: self closing tag html 
Html :: links mail 
Html :: store json object in data attribute in html 
Html :: how to embed mp4 html 
Html :: are h1 block elements 
Html :: nepal location 
Html :: lightning-textarea size 
Html :: make linear diagram html 
Html :: export figma design to html 
Html :: java ee static html 
Html :: twitter card tags 
Html :: razor view comment out line 
Html :: como recupperar senha html 
Html :: banner slider bootstrap 
Html :: Representing the transition on image 
Html :: player 
Html :: change the size of canvas char.js 
Html :: download file from link html 
Html :: selecting only one radio button 
Html :: HTML tag to define an internal style sheet 
Html :: all codes of html 
Html :: <link rel = "icon" href = "logo.jpg" type = "logo" issue 
Css :: disable selected text css 
Css :: @media between two sizes 
Css :: locate canvas in center of screen css 
Css :: html static background 
Css :: there is no tracking information for the current branch 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =