Forum Moderators: open
What I am trying to do, is turn this into a form. You can check one or many boxes, to either edit, delete, publish or unpublish those item(s). I have the functions to remove items, etc and can do all the PHP things, but I dont know javascript. Basically, I have a couple images that are the submition, and depeding on which you click, it will send you and the $_POST data where you need to go (for example, click edit sends you to index.php?task=content&action=edit/delete/publish).
Is there any quick way to tag the input type=submit to have this sent there and will it be able to handle the multiple checkboxes?
Thanks.
I would link to a demo, but its only running localhost at the moment. I do plan to release GNU in the future, or just as a free framework to let a community take over.
<input type="checkbox" name="prod_1" id="prod_1" value="1"> <label for="prod_1">Edit 1</label>
<input type="checkbox" name="prod_2" id="prod_2" value="2"> <label for="prod_2">Edit 2</label>
<input type="checkbox" name="prod_3" id="prod_3" value="3"> <label for="prod_3">Edit 3</label>
<input type="checkbox" name="prod_4" id="prod_4" value="4"> <label for="prod_4">Edit 4</label>
<input type="checkbox" name="prod_5" id="prod_5" value="5"> <label for="prod_5">Edit 5</label>
You should be able to do that with one form, except that it could potentially make for a very long page when you arrive. A check box value exists in the post only if it's checked, so you only need to see if it is in the post - that is,
if (isset($_POST["prod_1"])
Of course, you'd want to do a loop to check that. If I select items 1, 3, and 5 in the above, you'd iterate through the post variables, take the ones that start with prod_, and set a form based on their values:
<label for="prod_5">Content 5</label>
<textarea name="prod_5" id="prod_5" rows="5" cols="55"> (value for content 5)</textarea>
As I said this can make for a rather long form, but is this what you are looking for?
I would link to a demo,
Anyways, that is sort of what I need. I know how to loop everything through and checking with isset...
What I am trying to do exactly, is in my table, next to each data, I want to be able to check any boxes and click the image below for delete or unpublish, o rpublish, and so on (except editing, dont want to mass edit).
I cant figure out how to change each action for submitting the form. I want unpublishing to send to task=content&action=unpublish and say deleting to send to task=content&action=delete.
Is there a way to change each action of these images (the images are submit type)?