/*
`I have some dynamic checkboxes and corresponding textboxes.
When a user ticks a checkbox and enters data into the corresponding textbox and submits, the value of the checkbox and textbox should be inserted into the database. I can insert the checkbox values perfectly, but the textbox values have issues.
How I can do it ?
Below is the code.. I am not able to print checkbox's textbox value`
*/
if(isset($_POST['submit']))
{
$email=array(); // Checkbox array
$different_kvs=array(); // textbox array
foreach($_POST['contactid'] as $i => $contenti)
$email[$i]=$contenti;
$elements = count($_POST['kv']);
if($elements > 0)
{
for($i = 0; $i <= $elements; $i++)
{
echo $_POST['kv'][$i];
echo $email[$i]; // Line number 26
}
}
}
abhi10kumar
0
Junior Poster
Recommended Answers
Jump to PostMaybe try this (line 26):
echo isset($email[$j])?$email[$j]:"";
All 14 Replies
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
abhi10kumar
0
Junior Poster
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
abhi10kumar
0
Junior Poster
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
abhi10kumar
0
Junior Poster
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
abhi10kumar
0
Junior Poster
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
abhi10kumar
0
Junior Poster
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
abhi10kumar
0
Junior Poster
pritaeas
2,134
¯\_(ツ)_/¯
Moderator
Featured Poster
AndrisP
193
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.