Form Creation
#1
Hi Folks, 

I'm wondering what the best way to create a form would be? It just needs to be a simple form to insert into a database, I'm just wondering if there's a special MyBB way, or if you guys have any tips. 

On another note, one of my fields has to be able to handle html input (paypal button form), and if you have any advice for sorting that, I'd love to hear it.

Thanks,
Flinty

Update;

So I presumed that I could work with a regular form, however I'm having a template issue. I'm using the following piece of code to display a form:

elseif(isset($_GET['add']) && isModeration($modArray)) {
    echo 'test';
    eval("\$products .= \"".$templates->get("paypalShopTemplateClosed")."\";"); //Evaluate template

} 

Test is echoed, so I know the condition is working, however the template evaluation does not. If this condition isn't met, another template is rendered out instead of this.
Reply
#2
I pressume you have a way to figure out which template is being rendered and on what part of your PHP code that said template is eval'd? Because with the piece of code and limited information you provide us with we can only guess.
Soporte en Español

[Image: signature.png]

Discord at omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#3
So as it stands, when that condition is being met, no template is being rendered, however when there is no GET attribute, everything works as expected. I'll post more of the code now:

        elseif(isset($_GET['add']) && isModeration($modArray)) {
            echo 'test';
            eval("\$products .= \"".$templates->get("paypalShopTemplateClosed")."\";"); //Evaluate template
        } 
        else {
            
            //Render out products

            $query = $db->write_query("SELECT * FROM " . TABLE_PREFIX ."paypal"); //Query
            if(!$db->fetch_array($query)) {
                $error = "<center><h2>No Items. Add some now!</h2></center>";
            }
            while($res = $db->fetch_array($query)) { //Loop through each product
                $productID = (int)$res['productID'];
                $productName = htmlspecialchars($res['productName']);
                $productImg = htmlspecialchars($res['productImg']);
                $price = htmlspecialchars($res['price']);
                $desc = htmlspecialchars($res['productDesc']);
                $paypal = $res['paypalButton'];
                
                if(isModeration($modArray)) {
                    $delete = '<a href="Shop.php?delete=' . $productID . '" class="button">Delete</a>';
                }
                else {
                    $delete = '';
                }
                
                eval("\$products .= \"".$templates->get("paypalShopTemplateItem")."\";"); //Evaluate template
            }
            eval("\$product_container = \"".$templates->get("paypalShopTemplateProducts")."\";"); //Evaluate container template
        }

So paypalShopTemplateItem works perfectly fine and as expected, however the template eval in my original post does not work.
Reply
#4
Still looking for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)