1

So I'm doing this website with Joomla and I don't have much experience with Joomla. I just want to get the values of some checkboxes and print them into a text area.
I have the script already, I just need to implement it.

Here the raw Html code of the checkboxes:

<div class="checkboxShop">
    <form action="" method="post">
        <input type="checkbox" value="1" id="checkboxShopInput" name="shop" />
        <label for="checkboxShopInput"></label>
    </form>
</div>

And Here is the raw Html code of the submit button:

<form action="/Flex/index.php/shop" method="post">
<input type="submit" value="Buy">
</form>

All I want is to get all the values of the checkboxes and add them to a textarea in index.php/shop. I wrote this code to get the values but i don't know where to add this:

<?php
if(!empty($_POST['shop'])) {
    foreach($_POST['shop'] as $check) {
            echo $check; //echoes the value set in the HTML form for each checked checkbox.
                         //so, if I were to check 1, 3, and 5 it would echo value 1, value 3, value 5.
                         //in your case, it would echo whatever $row['Report ID'] is equivalent to.

            echo "<input type='text' name='message' value='" . $check . "'>"
    }
}
?>

I've read that i need this but I'm not sure how: <?php include "name_of_script.php";?>

Thanks for the help

2

There are 3 extensions that allow you to add PHP in Joomla: Jumi, Sourcerer, and DirectPHP. Most people prefer Sourcerer since it's easy, solid, and straightforward to use. Direct PHP is a favorite among beginners because it's the easiest. Jumi is a bit more complex than the other 2 (not sure if that has changed lately).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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