user2669924
user2669924

Reputation: 85

checkbox values are not getting displayed

I am trying to export selected names to excel. But before exporting , when i select the values through checkbox, its not getting selected.

I am doing like this

<form action="select.php" method="post" >
{listing_dataset}
<div class="listing result_row_{row_num_even_odd}">
    <div class="listingtitle">

    **<input type="checkbox" name="name" />**
        <a href="{edit_listing_link}" title="{lang_admin_listings_editor_modify_listing}">{listing_title}</a> <span class="listingid">({listingid})</span>

and closing form at the end like this

<input type="submit" value="EXPORT SELECTED" name="export" />
</form>

in select.php, i am trying to get the selected name which is not happening, instead it just displays 'on'

<?php

if(isset($_POST['export']))

{
$name = $_POST['name'];

echo $name; 
}

?>

what i should do to get the values? please suggest

Upvotes: 0

Views: 99

Answers (2)

Ritesh A
Ritesh A

Reputation: 283

For every checkbox, you have to provide value as directed by zzlalani. If the checkboxes are in the same group, just provide the same name to each.

The name of every checkbox item should be same. The values has to be different(in your case).

Upvotes: 0

zzlalani
zzlalani

Reputation: 24354

You need to give the value attribute to your checkbox

<input type="checkbox" name="name" value="something" />

may be {listingid} or {listing_title} in your case

Upvotes: 2

Related Questions