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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:27:26+00:00 2026-05-25T21:27:26+00:00

I mean, I’m trying the web link to look like something.com/newpage.php?id=123… . What I

  • 0

I mean, I’m trying the web link to look like something.com/newpage.php?id=123....

What I have is a form, and a JavaScript function on load that runs this AJAX:

$.ajax({
    type: "POST",
    url: "postear.php",
    data: "addcontentbox=" + addcontent,
    success: function() {
        $("ul#wall").prepend("<li><a href='newpage.php?id=<?php echo $rows['id']; ?>'  target='_blank'>"+addcontent+"</a></li>");
        $("ul#wall li:first").fadeIn();
        document.postbar_add_post.addcontent.value='';
        $('form#postbar_add_post input[type="submit"]').removeAttr('disabled');
    }
});

and this is the PHP function that is calls on the url:

<?php
if(isset($_POST['addcontent'])) 
{
    // Connection to Database
    include('config.php');

    // No Query Injection
    $message = mysql_real_escape_string($_POST['addcontent']);

    // echo
    $sql = 'INSERT INTO test.wall (message) VALUES("' . $message . '")';
    $result = mysql_query($sql);
    $rows = mysql_fetch_array($result);
    mysql_query($sql);
    echo $message;
}
else
{
    echo '0';
}
?> 

also, tried to place there a _GET [id].. but nothing.

Any help ?

pd:the dabase is:

CREATE TABLE `test`.`wall` (
`id` INT( 6 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`message` VARCHAR( 255 ) NOT NULL
) ENG
  • 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-25T21:27:26+00:00Added an answer on May 25, 2026 at 9:27 pm

    first u need to change this lines

    success: function() {
    $("ul#wall").prepend("<li><a href='newpage.php?id=<?php echo $rows['id']; ?>'  target='_blank'>"+addcontent+"</a></li>");
    

    to

    success: function(data) {
    $("ul#wall").prepend("<li><a href='newpage.php?id="+data+"    target='_blank'>"+addcontent+"</a></li>");
    

    and in the php file instead of this three lines

       $rows = mysql_fetch_array($result);
        mysql_query($sql);
        echo $message;
    

    u should write

    echo mysql_insert_id();
    

    of course you have to set the id fild in the database to autoincrement first

    it doesn’t hurt to change this

    $sql = 'INSERT INTO test.wall (message) VALUES("' . $message . '")';
    

    to

    $sql = "INSERT INTO test.wall (`message`) VALUES('$message')";
    

    i mean it’s easier this way

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

Sidebar

Related Questions

I mean can I do something like this: var client = new WebClient(); var
I mean, I was trying to overload the operator<< inside the class like this
I mean the reverse of this function: styleObj = window.getComputedStyle(node); So something like this:
I mean, using css sprites on non static content like: Inside while(mysql_fetch_array())...
I mean, for pixel position, sizes, etc. It's not like I'll be making a
I mean, can I use the com.sun.org.apache (all subpackages) classes as I use they
I mean like this T It's no 3 Character T T It's no 3
I mean like for everything, for example: instead of- // this does a directory
I mean I've set up a choicebox. msg = What would you like to
I mean if I write something in the code: NSString *myKey = @this 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.