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

  • Home
  • SEARCH
  • 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 6578473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:46:31+00:00 2026-05-25T15:46:31+00:00

I have a form which I call via AJAX (for use on a CMS)

  • 0

I have a form which I call via AJAX (for use on a CMS) and then this form is used to update the database for the content, however its not working and I cant seem to figure out where.

It all works up to the submit, as in the fields are all filled out correctly with the database rows, columns etc and the data is pre-filled with what is there currently. The issue lies somewhere between the AJAX submit() function and the eupdate.php MySQL query.

eform.php (pulled via another page, eindex.php, to be displayed)

<?php
require("../mcfrdb.php");
// Included database once using the require method

$item = $_POST['item'];
$page = $_POST['page'];

$row = mysql_query("SELECT * FROM mcfr WHERE pageid = '$page'");
$data = mysql_fetch_array($row);
?>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript">    </script>
<script type="text/javascript">var $j = jQuery.noConflict();</script>

<script type="text/javascript">

function submit(){
$j.ajax({ 
type:"POST",
url:"eupdate.php", 
data: "item=" + $j('#item') + "&itemcont=" + $j('#itemcont') + "&page=" + $j('#page'),
success:function(response){ 
    $j("#msg").html(response); 
    }
}); 
}

</script>
<div id="msg"></div>
<form id = "edititem" name = "edititem" onsubmit="return false;" method="post" >
<textarea cols="20" rows="5" name="itemcont" id="itemcont"><? echo $data[$item]; ?></textarea>    <br/>
<input type="text" name="item" id="item" value="<? echo $item; ?>"><br/>
<input type="text" name="page" id="page" value="<? echo $page; ?>"><br/>
<input type="button" value="make changes" onclick="submit()" >
</form>

eupdate.php

<?php
require("../mcfrdb.php");
// Included database once using the require method

$item=$_POST['item'];
$page=$_POST['page'];
$newcont=$_POST['itemcont'];

$row = mysql_query("UPDATE mcfr SET '$item' = '$newcont' WHERE pageid = '$page'");  

?>

When i click my button to submit, upon checking my DB after this, nothing has changed or updated.

Thanks in advance for all replies, here’s hoping we can get this fixed 🙂
Cheers

  • 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-25T15:46:32+00:00Added an answer on May 25, 2026 at 3:46 pm

    Since you’re submitting your data with AJAX, you don’t need to use a form element (especially that it requires you to do additional things to prevent it from being submitted normally).

    Anyway, the basic problem is probably how you (don’t) retrieve the values of the fields. $j('#item') returns the jQuery object bound to the item input, not its value. To get the value, use the .val() method, e.g.: $j('#item').val().

    As a side note, you also need to escape the posted data in your PHP script before using it in any SQL queries, otherwise you’re vulnerable to some terrible SQL injection attacks. See the documentation of mysql_real_escape_string for an explanation: http://php.net/manual/en/function.mysql-real-escape-string.php

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

Sidebar

Related Questions

I have a form and from this I call dialogPrintDiet.ShowDialog() which launchs my dialog.
I have a search form used to query service provisions, which I will call
I have a form which is used to insert/display and update . In the
I have a form, in which I need to send data selected via AJAX
I have this simple flyer page which uses jquery to reveal a form via
I have the following Ajax call which send form data to a page and
I have a form, which sends data through a Jquery Ajax Call over to
we have a form which inserts event data into mysql table, this then feeds
I'm facing a trouble with jquery ajax under IE8. I have a form which
I have some data which are loaded to table via jquery/ajax. Table has a

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.