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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:20:51+00:00 2026-05-18T02:20:51+00:00

I been trying to passing this value: // Content to submit to php Others

  • 0

I been trying to passing this value:

// Content to submit to php
Others string here. And this link:

to a php page, and insert it to database. here is my current code:

... // javascript

var content = $("#mcontent").val();
$.ajax({
    url : '<?php echo PATH; ?>functions/save.php',
    type: 'POST',
    data: 'id=<?php echo $_GET['id']; ?>&content=' + content + '&action=save&val=<?php echo md5("secr3t" . $_SESSION['userid_id']); ?>',
    dataType: 'json',

    success: function(response) {
        if (response.status == 'success') {
            alert(response.message);
        } else {
            alert(response.message);
        }
    }
});

No errors actually, but in database, what it saved is:

Others string here. And this link:

I guess i know whats the problem, the problem is the:

http://www.youtube.com/watch?v=CUUgKj2i1Xc&feature=rec-LGOUT-exp_fresh+div-1r-2-HM

I think it takes the “&feature=” as another POST data. What I have tried:

  • Adding slash before the ampersand (http://phpjs.org/functions/addslashes:303)

  • Using Javascript HTML encode/decode function (found somewhere on internet also)

But both does not work. Do you have any others way?

EDIT:

Do you foresee any others problem that might occurs? The content are type/write by user. Meaning that, the user can type/write anything. On backhand, I did others checking though, including the “mysql_real_escape_string”

  • 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-18T02:20:52+00:00Added an answer on May 18, 2026 at 2:20 am

    A nice thing about jQuery is that the data parameter can take a JS object, so you don’t need to try to build a query string manually.

    <?php
    
        $data = array("id" => $_GET['id'], 
                      "action" => "save", 
                      "val" => md5("secr3t",$_SESSION['userid_id'])
                     );
        $json_data = encode_json($data);
        $json_data = str_ireplace($json_data, '</script>', '<\/script>');
        echo "var data = $json_data;";
    ?>
    data.content = content;
    $.ajax({
                url : '<?php echo PATH; ?>functions/save.php',
                type: 'POST',
                data: data,
                dataType: 'json',
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to use SQLite with the PDO wrapper in PHP with mixed
Been trying to find a working implementation of a WPF listview (or listbox) where
Been trying to upgrade my subversion installation, but due to (what I believe) are
I been trying to get sqlcachedependecy working, but it doesn't appear to work I
I've been trying to understand how Ruby blocks work, and to do that I've
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
We've been trying to alter a lot of columns from nullable to not nullable,
I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss]
I've been trying to wrap my head around how threads work in Python, and
I've been trying to understand Process.MainWindowHandle . According to MSDN; The main window is

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.