fixing undefined variable notices in the index file
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 5 May 2017 20:24:38 +0000 (16:24 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 5 May 2017 20:24:38 +0000 (16:24 -0400)
power, sewer, water variables were not being set initially and were throwing errors , pre defined
the variables to avoid the notices

index.php

index 2f56322..815b554 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -115,7 +115,7 @@ function petosega_add_metaboxes() {
  */
 function petosega_water() {
     global $post;
-
+    $checked = '';
     // Get the features for the post.
     $water = get_post_meta( $post->ID, 'petosega_water', true );
     
@@ -161,7 +161,7 @@ function petosega_water() {
  */
 function petosega_loop() {
     global $post;
-    
+    $value = '';
     // Noncename needed to verify where the data originated.
     $nonce = wp_create_nonce( 'petosegameta-meta-noncename' );
     echo '<input type="hidden" name="petosegameta-meta-noncename" id="petosegameta-meta-noncename" value="' . $nonce . '" />';
@@ -189,7 +189,7 @@ function petosega_loop() {
  */
 function petosega_sewer() {
     global $post;
-    
+    $checked = '';
     // Noncename needed to verify where the data originated.
     $nonce = wp_create_nonce( 'petosegameta-meta-noncename' );
     echo '<input type="hidden" name="petosegameta-meta-noncename" id="petosegameta-meta-noncename" value="' . $nonce . '" />';
@@ -200,9 +200,11 @@ function petosega_sewer() {
     if ( "yes" === $sewer ) {
         $checked = 'checked="checked"';
     }
+
     ?>
     <input type="checkbox" name="petosega_sewer" value="yes" <?php echo $checked; ?> />
     <?php
+
 }
 /**
  * Petosega_campers
@@ -235,7 +237,7 @@ function petosega_campers() {
  */
 function petosega_power() {
     global $post;
-    
+    $value = '';
     // Noncename needed to verify where the data originated.
     $nonce = wp_create_nonce( 'petosegameta-meta-noncename' );
     echo '<input type="hidden" name="petosegameta-meta-noncename" id="petosegameta-meta-noncename" value="' . $nonce . '" />';
@@ -262,6 +264,7 @@ function petosega_power() {
  */
 function petosega_save_meta() {
     global $post;
+    print_r($_POST);
     if ( ! wp_verify_nonce( $_POST['petosegameta-meta-noncename'], 'petosegameta-meta-noncename' ) ) {
         return $post->ID;
     }