How to fix warning in php : Warning: Undefined variable $nameError in C:\xampp\htdocs\mysql\insert.php on line 84

As a beginner in PHP, I was trying to learn how PHP runs along with MySQL. So I was practicing how to insert data into a database using a form. So far this is what I did.

<?php error_reporting(E_ALL ^ E_WARNING);   define( "TITLE", "GET &amp; POST" );  if( isset( $  _POST["post_submit"] ) ) {          // build a function that validates data     function validateFormData( $  formData ) {         $  formData = trim( stripslashes( htmlspecialchars( $  formData ) ) );         return $  formData;     }          // check to see if inputs are empty     // create variables with form data     // wrap the data with our function          if( !$  _POST["post_name"] ) {         $  nameError = "Please enter your name <br>";     } else {         $  name = validateFormData( $  _POST["post_name"] );     }          if( !$  _POST["post_email"] ) {         $  emailError = "Please enter your email <br>";     } else {         $  email = validateFormData( $  _POST["post_email"] );     }      } 

?>

<head>          <meta charset="utf-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">      <title><?php echo TITLE; ?></title>      <!-- Bootstrap CSS -->     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">      <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->     <!--[if lt IE 9]>         <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>         <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>     <![endif]--> </head>  <body>     <div class="container">         <h1><?php echo TITLE; ?></h1>                  <h4>Submitted via $  _GET</h4>         <form action="form_get.php" method="get">             <input type="text" placeholder="Name" name="name">             <input type="text" placeholder="Email" name="email">             <input type="submit" name="form_submit">         </form>                  <hr>                  <h4>Submitted via $  _POST</h4>         <form action="form_post.php" method="post">             <input type="text" placeholder="Name" name="post_name">             <input type="text" placeholder="Email" name="post_email">             <input type="submit" name="post_submit">         </form>          <hr>          <h4>Submitted to current page</h4>                  <p class="text-danger">* Required fields</p>                  <form action="<?php echo htmlspecialchars($  _SERVER['PHP_SELF']); ?>" method="post">                          <small class="text-danger">* <?php echo $  nameError; ?></small>             <input type="text" placeholder="Name" name="post_name"><br><br>                          <small class="text-danger">* <?php echo $  emailError; ?></small>             <input type="text" placeholder="Email" name="post_email"><br><br>             <input type="submit" name="post_submit">         </form>                  <?php                          if( isset($  _POST["post_submit"]) ) {                 echo "<h4>Your info</h4>";                 echo "$  name <br> $  email <br>";             }          ?>                                </div>          <!-- jQuery -->     <script src="//code.jquery.com/jquery-2.1.4.min.js"></script>          <!-- Bootstrap JS -->     <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> </body> 

When I wasn’t using error_reporting(E_ALL ^ E_WARNING) it kept showing this warning message [ Warning: Undefined variable $ nameError in C:\xampp\htdocs\mysql\insert.php on line 84 ].

Can anyone help me why it’s showing that there is an undefined variable? Cause I think I defined this variable at the top portion of PHP code.

And is it a good practice to use the error_reporting() function to suppress the warning message from showing?

I am receiving a pluggable.php warning sign on my only http:// page

I just recently shared a link to my site ysing he http but instead of redirecting, i just displays this:

Warning: Cannot modify header information – headers already sent by (output started at /home/thecmltm/public_html/index.php:1) in /home/thecmltm/public_html/wp-includes/pluggable.php on line 1281

Warning: Cannot modify header information – headers already sent by (output started at /home/thecmltm/public_html/index.php:1) in /home/thecmltm/public_html/wp-includes/pluggable.php on line 1284

I have searched all over the web but they all talk about function.php or wp_configure.php but that is not what my problem is. I have tried editing the index.php but nothing is wrong with it.

Please help me. Thanks in advance!

Would an Imp be resistant to the bludgeoning damage from a Mace of Warning? [duplicate]

The Damage Resistances for a 5E Imp are:

Cold; Bludgeoning, Piercing, and Slashing from Nonmagical Attacks that aren’t Silvered

Would this Imp be resistant to damage from a Mace of Warning?

  • You could argue "Yes" because any Weapon of Warning should be considered a magical weapon, and therefore the damage it deals is considered magical.
  • You could argue "No", with a liberal interpretation of the resistances, because the mace is not silvered.

Router Security Warning in Logs

I’m getting regular attacks

2020-07-29 14:44:42 Security Warning ‭Intrusion -> SRC=80.227.225.108 DST=156.218.255.222 LEN=40 TOS=0x00 PREC=0x00 TTL=235 ID=63607 PROTO=TCP SPT=52363 DPT=1433 WIN‭ 

it’s every 10 mins as I can see

I changed wifi password and made it hidden AP and the attacks still coming.

I even disconnected all devices and the logs keep getting this attack

Should I be worried?

2020-07-29 14:54:05 Security Warning ‭Intrusion -> SRC=45.129.33.22 DST=156.218.255.222 LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=40337 PROTO=TCP SPT=42068 DPT=3378 WINDO‭ 

Warning message (re. php) on the blog page

I’ve got a message below (the part “xyz/blog-name.com” was changed). That error message is not because of a Plug-in, as the message doesn’t disappear even I stop all Plug-ins.

“Warning: Use of undefined constant php – assumed ‘php’ (this will throw an Error in a future version of PHP) in /home/xyz/blog-name.com/public_html/wp-content/themes/stingerplus-child/st-footer-content.php on line 20″

The line 20 in my wp currently reads as fallows;

<a href="<?php//echo esc_url( home_url( '/' ) ); ?>"><?php// bloginfo( 'description' ); ?></a> 

Can anyone please advise me what is wrong here…? Thanks

PHP Warning: Invalid argument supplied for foreach() in /home/padtvro/public_html/wp-content/themes/claudia/content.php on line 30

I have a problem, it is generated in woprdpree in cpanel error log this error: PHP Warning: Invalid argument supplied for foreach () in /home/padtvro/public_html/wp-content/themes/claudia/content.php on line 30 If I delete it, it appears again in 6-7 hours. What’s the problem?

<section id="contents" class="clearfix"><div class="row main_content"><div class="container content_wraper"><?php the_breadcrumb(); ?><div class="grid_8" id="content"><div class="widget_container content_page"><?php require_once dirname(__FILE__) . '/include/cat.php'; ?>  </div></div><div class="grid_4 p7ehc-a" id="sidebar"> <?php $  ge_sidebar = '';                  if (is_search()) {                       $  ge_sidebar = of_get_option('se_sidebar','');                     }else if(is_category() ) {                          $  category = get_the_category();                                               $  cn_sidebar ='';                         foreach($  category as $  ca_id) {                             if(empty($  cn_sidebar)) { $  cn_sidebar = of_get_option('cat_'.$  ca_id->term_id);}                                                        }                          if(empty($  cn_sidebar)) {                             $  ge_sidebar = of_get_option('cat_sidebar','');                         } else { $  ge_sidebar = $  cn_sidebar; }                       } else if(is_author() ) {                          $  ge_sidebar = of_get_option('au_sidebar','');                      }else if(is_tag() ) {                          $  tags = get_the_tags();                                               $  cn_sidebar ='';                         foreach($  tags as $  tg_id) {                             if(empty($  cn_sidebar)) { $  cn_sidebar = of_get_option('tag_'.$  tg_id->term_id);}                                                       }                          if(empty($  cn_sidebar)) {                             $  ge_sidebar = of_get_option('tag_sidebar','');                         } else { $  ge_sidebar = $  cn_sidebar; }                     }                                   $  dyn_sidebar ='';                 if(!empty($  ge_sidebar)) {   $  dyn_sidebar = $  ge_sidebar; };                                foreach ( $  GLOBALS['wp_registered_sidebars'] as $  sidebar ) {                     if($  sidebar['name'] == $  dyn_sidebar)                         {                              $  dyn_sidebar = $  sidebar['id'];                         }                 }                   if(!empty($  dyn_sidebar)) {                     if (is_active_sidebar($  dyn_sidebar)) : dynamic_sidebar($  dyn_sidebar);                     endif;                   } else{                     if (is_active_sidebar('center-sidebar')) : dynamic_sidebar('center-sidebar');                     endif;                 }      ?></div><div class="clear"></div></div></div></section>  

Why do I get this warning when using a null conditional operator?

In the OnTriggerEnter2D function of my Bullet script, I have the following code:

private void OnTriggerEnter2D(Collider2D other) {      if (other.CompareTag("Enemy"))      {          var enemy = other.GetComponent<Enemy>();          enemy?.Death();      } } 

The reason for the null conditional operator (the question mark) in enemy?.Death() is because the Death function actually destroys the Enemy component script, so it suppresses an error when the bullet hits the enemy again. It’s supposed to be shorthand for:

if (enemy != null)     enemy.Death(); 

The code works; the error is suppressed. However, the IDE that I’m using, Jetbeans Rider, gives the following warning:

‘?.’ on a type deriving from ‘UnityEngine.Object’ bypasses the lifetime check on the underlying Unity object.

What does that mean exactly? Should I continue using the null conditional operator?