1

What would I need to do so that every row has a unique input box, which the user inputs a numeric value, and then the category name is appended to it.

e.g

Category | Time
-----------------
Home     |   7

So that the 7 would be entered into the input box, but when the value is saved, it is appened with the category name. Bear in mind there would be multiple categories. This is what I have so far

$categories = get_categories($args);
          foreach($categories as $category) { 
            echo "<tr>";
            echo '<td><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></td>';
            echo "<td><input/></td>";
            echo "</tr>";
            } 
1
  • Are you just trying to provide a form that users can use to filter the posts displayed to a specific category? I.E., "Enter the category name to view all posts in that category."
    – Pippin
    Jun 4, 2012 at 14:42

1 Answer 1

0

I'm not quite sure how you'll be using these but wouldn't it make sense to concatenate the category ID with the name to make it unique?

<input type="text" name="<?php echo $category->term_id."-".$category->name; ?>" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.