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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:00:52+00:00 2026-06-17T05:00:52+00:00

My JQuery does not fire up the sanitize function.I need to take the value

  • 0

My JQuery does not fire up the sanitize function.I need to take the value from the input field name , sanitize it (with santize function) and display it in path input field. Why isn’t it working ? I use PHP 5.3 and HEIDISQL

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <?php 

    include('conect.php');
    if(($_POST)&&(!empty($_POST['name']))&&(!empty($_POST['path'])) ){
    $name=$_POST['name'];
    $path=$_POST['path'];

    function sanitize($title) {
        $title = strip_tags($title);
        // Preserve escaped octets.
        $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title);
        // Remove percent signs that are not part of an octet.
        $title = str_replace('%', '', $title);
        // Restore octets.
        $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);

        if (seems_utf8($title)) {
            if (function_exists('mb_strtolower')) {
                $title = mb_strtolower($title, 'UTF-8');
            }
            $title = utf8_uri_encode($title, 200);
        }

        $title = strtolower($title);
        $title = preg_replace('/&.+?;/', '', $title); // kill entities
        $title = str_replace('.', '-', $title);
        $title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
        $title = preg_replace('/\s+/', '-', $title);
        $title = preg_replace('|-+|', '-', $title);
        $title = trim($title, '-');

        return $title;
    }   

    mysql_query("UPDATE menus SET name='$name' , path='$path'");
    }

    ?>
    <html>
    <head>

    <script>


$(document).ready(
function(){
          $("#name").change(function(){
             $("#path").sanitize("name").val();             

          });
} );


</script>

    </head>

    <body>
            <form action="<?php $_PHP_SELF ?>" method="post">
            <label for="nume">Name</label><input type="text" name="name" />
            <label for="cale">Path</label><input type="text" name="path" />
            <input type="submit" name="submit"/>
    </form>
    </body>
    </html>
  • 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-17T05:00:53+00:00Added an answer on June 17, 2026 at 5:00 am

    It isn’t working because it is written in PHP and you are trying to run it client side as if it were JavaScript.

    You can’t trust the client to send you sanitised data — you don’t control the client.

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

Sidebar

Related Questions

js/jQuery: $('input[type=checkbox]').click(function(){ // Does not fire if I click a <input type=checkbox disabled=disabled />
I found out jQuery does not always create the correct DOM from an HTML
Hi my jQuery callback function does not work. Competitor = { addCompetitorForSave: function($data) {
I have a jQuery confirmation dialog that does not fire the event associated with
Jquery does not work on the Internet explorer . However it runs on other
Why this delay of Jquery animation does not work as it should be? $(
I am curious why jQuery's .after() does not chain, or provide you with, the
Internet Explorer does not like my Jquery selector. Not sure if it's my weak
jQuery's jqXHR object passed to the callback on failure does not parse json responses,
I have a button that does not work in jquery. A button is passed

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.