Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3793380
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:46:01+00:00 2026-05-19T12:46:01+00:00

I’m experiencing some kind of a problem here, I have no idea what’s wrong

  • 0

I’m experiencing some kind of a problem here, I have no idea what’s wrong with this code. I’m pretty sure it’s client sided since I am not getting any PHP errors, but I may be wrong.

I’m trying to get a form, once submitted, to insert the information contained in a text field into a MySQL database via an AJAX request to a PHP file.

Here’s where I’m at:

/* index.php */

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="scripts/ajax.js"></script>


//...


        <div class="success" id="success"></div>
        <div class="err" id="err"></div>


 <!--Create Form-->
 <form action="" method="post" name="create" id="createForm" onsubmit="createNew(document.create.create2.value); return false;">        
        <h5>Create New File</h5>
        <p><input name="create2" type="text" maxlength="32" /></p>
 <input type="submit" name="submit" value="Create" />
 </form>


/* ajax.js */

function createNew(name)
{
 $('#loading').css('visibility','visible');

  $.ajax({
  type: "POST",
  url: "../utilities/process.php",
  data: 'name='+name,
  datatype: "html",
  success: function(msg){

   if(parseInt(msg)!=5)
   {
    $('#success').html('Successfully added ' + name + ' into database.');
    $('#loading').css('visibility','hidden');
    alert('success');//testing purposes
   }
   else
   {
    $('#err').html('Failed to add ' + name + ' into database.');
    $('#loading').css('visibility','hidden');
    alert('fail');//testing purposes
   }
  }
      })
}


/* process.php */

<?
include('db_connect.php');

if($_POST['name'])
{
 $name = $_POST['name'];
 $name = mysql_escape_string($name);
 $query = "INSERT INTO tz_navbar (name) VALUES (".$name.")";
 $result = mysql_query("$query") or die ("5");

}
?>

Here’s my problem:
After I submit my form with something, it reports that is succeeds but nothing gets added to my database.

Thank you all in advance for taking your time to help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:46:01+00:00Added an answer on May 19, 2026 at 12:46 pm

    Looking at your query, I suspect you need it to be:

    $query = "INSERT INTO tz_navbar (name) VALUES ('".$name."')";
    

    If that doesn’t fix it, you need to log the value of $_REQUEST

    error_log(print_r($_REQUEST,true));
    

    to ensure that you are getting the right values on the server side.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.