0

Hi i did a code i php but it is not working i dont know why

Here is my code

update.php

<?php
$link=mysql_connect("localhost","root","root");
mysql_select_db("helixcrm",$link);
$q="select * from clientreg";
$ros=mysql_query($q);
$i=0;
while($row=mysql_fetch_array($ros))
    {
        if($i%2==0)
            $classname="evenRow";
        else
            $classname="oddRow";
        ?>

        <tr class="<?php echo $classname;?>">
        <td><input type="checkbox" name="users[]" value="<?php echo $row["id"]; ?>" ></td>
        </tr>
        <?php
        $i++;
    }?>

<?php
$focus = array();
$rowCount = count($_Post["users"]);
echo $rowCount;
for($i=0;$i<$rowCount;$i++) {

    $result = mysql_query("SELECT * FROM clientreg WHERE Id='" . $_POST["users"][$i] . "'");
    $row[$i]= mysql_fetch_array($result);
    //echo $row[$i]['interest'];
    $focus = explode(',', $row[$i]['interest']);
    $check = implode(',' , $focus);

    // echo $check;
    echo $row[$i]['id'];
}

?>

<form>
</form>

Here i this code $rowCount = count($_Post["users"]); not working here but if i write this on another php page it works

Where i am wrong

how can i achieve my output

any help will be appreciated

shakti sharma
  • 47
  • 1
  • 2
  • 10

1 Answers1

0

try to do it like this

    <?php
  if (isset($_POST['submit'])) {
    $example = $_POST['example'];
    $example2 = $_POST['example2'];
    echo $example . " " . $example2;
  }
  ?>
  <form action="" method="post">
     Example value: <input name="example" type="text" />
     Example value 2: <input name="example2" type="text" />
    <input name="submit" type="submit" />
 </form>
veritaS
  • 511
  • 1
  • 5
  • 23