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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:25:38+00:00 2026-06-09T19:25:38+00:00

I have this script: var wall_user_id = <?php echo $_SESSION[‘user_id’];?>; $.ajax({ type: POST, url:

  • 0

I have this script:

             var wall_user_id =  "<?php echo $_SESSION['user_id'];?>";

 $.ajax({
            type: "POST",
            url: "insert.php",
            data: "user_id=" + wall_user_id,
            success: function () {
                $('ul#posts').prepend(wall_post);

            }
        });//end success function

that send wall_user_id to the php script:

      <?php
      require 'core/functions/init.php';

      $user_id = mysql_real_escape_string($_POST['user_id']);
      $sql = 'INSERT INTO wall (user_id) VALUES('.$user_id.')';
      mysql_query($sql);
      ?>

this works fine but it doesn’t if I try to add more values like this:

         var wall_user_id =  "<?php echo $_SESSION['user_id'];?>";
             var wall_userimage = "<?php echo $user_data['imagename']; ?>";

 $.ajax({
            type: "POST",
            url: "insert.php",
            data: "user_id=" + wall_user_id +"userimage="+ wall_userimage,
            success: function () {
                $('ul#posts').prepend(wall_post);

            }
        });//end success function

and insert.php:

 <?php
      require 'core/functions/init.php';

      $user_id = mysql_real_escape_string($_POST['user_id']);
      $userimage = mysql_real_escape_string($_POST['userimage']);

      $sql = 'INSERT INTO wall (user_id, image) VALUES('.$user_id.','.$userimage.')';
      mysql_query($sql);
      ?>

it doesn’t inserts any values into the database.
what am I doing wrong?

  • 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-09T19:25:39+00:00Added an answer on June 9, 2026 at 7:25 pm

    You could pass as many values as you want in the data:

    data: { user_id: wall_user_id, userimage: wall_userimage }
    

    and in your example use & to separate parameters:

    data: "user_id=" + wall_user_id + "&userimage=" + wall_userimage
    

    But the first method is the recommended way because jQuery takes care of properly url encoding the values. With your example if you wanted to do it properly you should have written:

    data: "user_id=" + encodeURIComponent(wall_user_id) + "&userimage=" + encodeURIComponent(wall_userimage)
    

    which obviously is way too much code for this. So use the first approach.

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

Sidebar

Related Questions

I have this jQuery script var dataString = class_id=+class_id; $.ajax({ type: POST, url: page.php,
I have this code: <div id=gll_select> <script> var caffe = $(#caffe).val(); $(#gll_select).load(<?php echo base_url()
I have a PHP File with something like this: <script type=text/javascript> var page =
I have this code: <script type=text/javascript> var maxLength=10; function charLimit(el) { if (el.value.length >
Okay, I have this code: <script language=javascript type=text/javascript> <!-- function requestPage(page) { var request
I have this little batch script: SET @var = GREG ECHO %@var% PAUSE When
I have this script protovis : <script type=text/javascript+protovis> var w = 600; var h
so i have this script: <script type=text/javascript> $(window).load(function () { var imagePath = new
I have this script which is used to append: function append_place(type) { var shop_type
I have this piece of javascript: <script type=text/javascript> function show_confirm() { var type =

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.