Welcome Guest, Not a member yet? Register   Sign In
Form Tags disappear
#1

[eluser]pgsjoe[/eluser]
Tried checking the forums first, didn't really see anything about this. And sometimes, I almost think maybe one or two of you out there appreciate my questions, because they're usually something very simple I'm just overlooking.

Well here's my problem, I can't get the form_open function to display in the browser. Which, wouldn't be so weird, but it's omitting my closing 'form' tag from the page as well. Kind of weird, right? Here's what I'm working with. It's pulling in the header and even loading the correct view, but the form...just yeah. Specifically working with the add_photos function.

Code:
<?php
class Photos extends Controller {

    function Photos()
    {
        parent::Controller();
        $this->load->helper('url');
        $this->load->helper('form');
        
        $this->load->scaffolding('photos');
    }
    
    function index()
    {
        $data['query']        = $this->db->get('photos');
        
        $this->load->view('photoList', $data);
    }
    
    function add_photos()
    {
        $data['header']        = "Add Photos";
        
        $this->load->view('photoForm', $data);
    }
}
?>
photoForm.php
Code:
<div id="contentArea">
    <div id="primaryContent">
        <h2>&lt;?=$header?&gt;</h2>
        
        &lt;?=form_open('photos/photo_insert');?&gt;
        
        <p><label for="photoTitle">Title</label>
            &lt;input type="text" name="photoTitle" /&gt;</p>
        <p><label for="photoAlt">Alt</label>
            &lt;input type="text" name="photoAlt" /&gt;</p>
        <p><label for="photoDirectory">Directory</label>
            <select name="photoDirectory">
                <option value="test1">Test 1</option>
                <option value="test2">Test 2</option>
                <option value="test3">Test 3</option>
            </select></p>
        <p><label for="photoFile">File</label>
            <select name="photoFile">
                <option value="test1.jpg">test1.jpg</option>
                <option value="test2.jpg">test2.jpg</option>
                <option value="test3.jpg">test3.jpg</option>
            </select></p>
        
        <p>&lt;input type="submit" name="submit" value="add photo" /&gt;</p>
        
        &lt;/form&gt;
        
    </div>
    
    <div id="secondaryContent">
        <img src="&lt;?=$root?&gt;assets/css/logo.jpg" width="160" height="40" />
        <div id="contactInfo">
            &lt;?php include ($directory . 'includes/contactInfo.php'); ?&gt;
        </div>
    </div>
    <div class="clear"></div>
</div>
#2

[eluser]tonanbarbarian[/eluser]
try turning off the scaffolding and see if that helps
also try moving the load helper call inside the function rather than in the constructor (i believe there are some versions of php where if you load some libraries and helpers etc in the constructor there are issues)
#3

[eluser]pgsjoe[/eluser]
Tried both. Neither seemed to help. Any other idears? Appreciated!
#4

[eluser]pgsjoe[/eluser]
Actually...one of them must have worked.

Hmmm...just dug back into my code. Looks like I needed to have the action set up as a function. Once that was in place, doesn't look like scaffolding or having the helper loaded locally to the function mattered. Thanks for looking into it for me!




Theme © iAndrew 2016 - Forum software by © MyBB