HTML Form not submitting to database can AJAX cause this

HI guys.

somethign funny is happening, sometimes it submits to the database, but for the most part it doesnt,??? very confused. i did remove the include as stated. and My var_dump() shows that the values are there

any suggestions

Show us the code as it is now.

What is the difference (in terms of the data) between the times when it submits to the database, and the times when it does not?

Is there an issue with data format (causing the query to fail) or missing data (causing the query to fail if you have any “required” columns)?

If you var_dump() the raw $_POST array and the variables after you’ve escaped them, do you see any issues? If you then put those values manually into the query in something like phpmyadmin, does it work, or do you get an error message?

Ok, I found the culprit but some advise will be appreciated.

it is actually one of my variables that is not assigned a value and thus not executing my code properly.


The problem thus i have is the following.
I have a separate PHP file where the Query gets its information from ie… populating the second drop down with specific information.

now on my new PHP insert, that value is not carried over and thus not being checked and inserted. how do i carry that value over, (SESSION,COOKIES,POST) or maybe im totally off

an example of a proposed solution would be great

Surely the value should be passed in as whatever the user chose in the <select> drop-down? The fact that the drop-down was populated by PHP via an Ajax call shouldn’t be relevant.

Prior to the Ajax call, your <select> tag has no name, so that won’t help it appear in the form.

<div id="stype">
    
    <p>Please select the type of Defect you wish to report</p>
       
    <select>
        <option>select</option>
        
    </select>
        </div>

As you replace all that html with the response from your Ajax call (I think), you’d need to post the code for ajax.php for anyone to be able to suggest how it is solved.

document.getElementById("stype").innerHTML=xmlhttp.responseText;

Thanks alot, i got it working, was the name of my select in my ajax.php file had no name…

thanks for all you awesome help

really appreciated

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.