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 9229431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:34:12+00:00 2026-06-18T05:34:12+00:00

So I have this form: echo ‘<form id=target action=edit-property.php?Property=’.$property.’ method=post>’; echo Address: .'<input type=text

  • 0

So I have this form:

echo '<form id="target" action="edit-property.php?Property='.$property.'" method="post">';
echo "Address: ".'<input type="text" name="address" value="'.$propAddress.'" />';
echo '<input type="submit" value="Update">';
echo "</form>";

And on submission I change the database entry with this function (I’m still learning the change from mysql to mysqli, so im not sure if i’ve done it right and I don’t totally know how to bind params when it comes to updating a table, but thats not my question)

$property = $_GET['Property']
if (isset($_POST['address']) && !empty($_POST['address'])) {
$mysqli = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);
    if (!$mysqli) {
        die('There was a problem connecting to the database.');
    }
    else {
        $address = mysqli_real_escape_string($mysqli, $_POST['address']);
        $id = intval($property);
        if($id) {
        $query =("UPDATE Properties
            SET Address = '$address'
            WHERE Id = '$id'");
            if (mysql_query($query)){
                echo '1';
                exit;
            }
            else {
                echo '0';
                exit;
            }
            $mysqli->close(); 
        }
    }
}

Alrighty. So that works ok (please feel free to correct me if i’ve done something stupid here, I find that I learn best through the criticism and stackoverflow has helped me heaps in improving!)

But here’s my dilemma. I want to update on page without having to refresh the page.

I came across the code below, modified it to suit me and unfortunately it isn’t working. I’m afraid I don’t know why:

<script>
var id = <?=$id?>;
// when the DOM is ready
$(document).ready(function() {
    $('#target').submit(function(e) {
        // prevent normal, boring, tedious form submission
        e.preventDefault();
        // send it to the server out-of-band with XHR
        $.post('edit-property.php?Property=' + id, function() {
            data: $(this).val(),
            success: function(resp) { 
                if(resp == '1') {
                    alert('Saved successfully');
                } else {
                    alert('Oops, something went wrong!');
                }
            }
        });
    });
});
</script>

It’s a mystery unfortunately – Can’t get it working. What could I be doing wrong?

Thank you 🙂

  • 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-06-18T05:34:14+00:00Added an answer on June 18, 2026 at 5:34 am

    I think you’ve misunderstood the syntax of this call and you have wrapped some of the parameters intended for the $.post into a superfluous “function” that your probably expected to use for completion.

    $.post('edit-property.php?Property=' + id, 
                /*function() {*/
                data: $(this).val(),
                success: function(resp) { 
                    if(resp == '1') {
                        alert('Saved successfully');
                    } else {
                        alert('Oops, something went wrong!');
                    }
                /*}*/
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form into PHP pages: echo "<form action=\"xxx.php\" method=\"post\" id=\"test\" name=\"test\"> <input
I have this form: <form action=index.php?type=add_lesson&type=add method=post> <?php echo $lesson_title; ?><br/><input type=text name=title style=width:450px;
I have form like this: <form method=POST action=<?php echo base_url() ?>admin/admin_search> <fieldset> <label for=nalozi>Nalozi</label><input
I have this: <form action=profiles.php method=POST name=SearchSimple id=SearchSimple > <input name=search id=s style=width: 150px;
I have this form: <form action=image_upload.php method=post enctype=multipart/form-data> Image 1: <input type=file name=event_image />
I have this html form echo <form name='delete_article_form.$row['id'].' action='sources/public/article_processor.php' method='POST' >; echo <input name='processor_switcher'
I already have this script <FORM method=POST name=ajax action=#> <INPUT type=submit class=env_buttn value=<?php echo
I have this form: <form name=commentform id=commentform action=comment.php method=post enctype=multipart/form-data> Your Name: <textarea maxlength=60
I have this form: <FORM id=frmVote action=../vote_dir/proccess.php method=post> <table id=tblMain align=center> <tr> <td class=header></td>
I have this form: <form action= method=post> <label for=color>Color:</label> <input type=text style=width: 195px; name=color

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.