I'm building a CMS in PHP and this is my first attempt to use ajax to do something cool. It's making my queryies problematic, however. I'm writing in this forum because my PHP forms worked fine before I did the following:

On my index page, I have a header with a menu in one DIV and a content area in another. What I wanted was selecting a menu item to load the appropriate .php form in the content DIV. I found this fun ajax script to serve that purpose. So my menu items look like this:

<a href="javascript:ajaxpage('lrs_addstudent.php', 'contentarea');">Add Student</a>
<a href="javascript:ajaxpage('es_selectstudent.php', 'contentarea');">Select Student</a>

etc.

Anyway, the .php pages load into the DIV, but when I submit the forms that are in them, it doesn't recognize any of the included scripts or database connection, nothing. I've been trying to conceptualize what's happening, but I can't wrap my head around it. Can anyone explain please?

Have you already checked that
1) the forms action attribute's path is correct to the main page ?
2) and the form is actually submitting and there isn't any javascript intercepting the forms submit event ?

I forgot to mention that my forms were made using the PHP Form Builder Class ([http://code.google.com/p/php-form-builder-class/]). I am not sure how to check the action attribute..? All I can tell is that when the submit button is clicked, all the warnings and errors are returned. Here is the code for one of the forms (I get the "is not set") message - meaning the form is not submitting; but why?):

if(isset($_POST["form"])) {
    if(PFBC\Form::isValid($_POST["form"])) {

        //mysql stuff

    } else {die("is not valid")
    }
} else {die("is not set");
}

$form = new PFBC\Form("StudentInfo", 400);
$form->addElement(new PFBC\Element\Hidden("form", "StudentInfo"));
$form->addElement(new PFBC\Element\Textbox("Student Name:", "Student", array(
    "required" => 1
)));
$form->addElement(new PFBC\Element\Select("ES:", "ES", $esnames, array(
    "required" => 1)));
$form->addElement(new PFBC\Element\Select("Default Grade:", "Grade", $grades, array(
    "required" => 1)));
$form->addElement(new PFBC\Element\Button("Save")
);
$form->render();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.