Jump to content

What is wrong here!?!?!


Go to solution Solved by Ch0cu3r,

Recommended Posts

Hello there! Today when i was coding, i meet something really weird (To me atleast)..

The thing is, when i try to press the "btnVote" button i try to dump i get id 2 on both.

 

But the id shows right, (1 and 2) on the button etc. But idk what is the wrong here..

Thanks for help

 

Alright, here is the script

<?php include 'engine/init.php'; include 'layout/include/top.php';  


$picture = mysql_select_multi("SELECT * FROM `contest_images` ORDER BY ID ");
$userIp = getIP();
$btnVote = getValue($_POST['btnVote']);

$errors = false;


?>

<p>


   <?php foreach ($picture as $pictures) {
       
   ?>     
<p>
      <div class="content-box">
        
        <div class="content-box-header">
        
          <h3>Picture #<?php echo $pictures['id'] ?></h3>
          
        </div> <!-- End .content-box-header -->
        
        <div class="content-box-content">
          
          <div class="tab-content default-tab">
            <center>
          <form action="" method="POST"><input type="submit" name="btnVote" value="Vote on picture <?php echo $pictures['id'] ?>"></form>
          <?php data_dump($pictures['id']); ?>
        </center>
            <p>
              <center>
             <?php echo '<img src="'.$pictures['image_path'].'" alt="Image" style="width: 800px; height: 500px">'; ?>
           </center>
            </p>
            
          </div> <!-- End #tab3 -->        
          
        </div> <!-- End .content-box-content -->
        
      </div> <!-- End .content-box -->

    
    <?php
       }

         if ($btnVote !== false) {
          #header('Location: http://localhost/contest/?='.$pictures['id']);
        echo data_dump($pictures['id']);
        }

   ?>



<?php include 'layout/include/bot.php'; ?>
Link to comment
https://forums.phpfreaks.com/topic/282908-what-is-wrong-here/
Share on other sites

  • Solution

The thing is, when i try to press the "btnVote" button i try to dump i get id 2 on both.

of what?

 

Shouldn't data_dump($pictures['id']); here

         if ($btnVote !== false) {
          #header('Location: http://localhost/contest/?='.$pictures['id']);
        echo data_dump($pictures['id']);
        }

be data_dump($btnVote);

Link to comment
https://forums.phpfreaks.com/topic/282908-what-is-wrong-here/#findComment-1453646
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.