Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
Getting value from individual input field

I'm having trouble getting this into a $_POST value how would I go about this? So basically I want to get each value.

<?php

require "scripts/db.ini.php";

$sql22 = "SELECT * FROM `category` WHERE `delete` = '0' AND `side` = 'right'";
//query
$query22 = mysqli_query($db,$sql22);
while($rows22 = mysqli_fetch_assoc($query22)){

$db_id = $rows22['id'];
$db_name =$rows22['name'];

echo "<input type='checkbox' name='$db_name' value='$db_id'>$db_name<br>";

}

?>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try use foreach like this

$sql22 = "SELECT * FROM `category` WHERE `delete` = '0' AND `side` = 'right'";
//query
$query22 = mysqli_query($db,$sql22);
echo '<form action="" method="POST">';
while($rows22 = mysqli_fetch_assoc($query22)) {
    foreach($rows22 as $row) {
        echo '<input type="checkbox" name="'.$row['name'].'"  value="'.$row['id'].'">'.$row['name'].'<br>';
    }
}
echo '<input type="submit">';
echo '</form>';
echo '<pre>';
print_r($_POST);
echo '</pre>';
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!