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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:15:38+00:00 2026-06-01T08:15:38+00:00

My script does not seem to be working. Every time i try to use

  • 0

My script does not seem to be working. Every time i try to use the form i’ve get the error with readystate=0, and status=0. Any help will be appreciated.
I’ve got the following form:

<form action="" method="post" >

    <input type="text" name="name" id="tekst"/><br/>
    <input type="text" name="name" id="autor"/><br/>
    <input type="submit" name="<?php echo $id; ?>" value="Send" id="submit"/>

</form>
<div class="response"></div>

the values from input fields are then processed by the following code:

$("input#submit").click(function(){  
var id = $("input#submit").attr("name");
var autor =  $('input#autor').val();
var tresc = $('input#tekst').val();


$.ajax({
    type: "POST",
    url: "add_comment.php",
    data: 
    {id: id, 
    autor: autor, 
    tresc: tresc}, 
    success: function(data){
        $(".response").text(data);  
    },
   error:function(xhr,err){
    alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);
    alert("responseText: "+xhr.responseText);

    }



});
});

Here is my add_comment.php:

<?php
$id = $_POST['id'];
$autor= $_POST['autor'];
$tresc = $_POST['tresc'];

if(isset($id) && isset($autor) && isset($tresc)){
include("db/connection.php");

$zapytanie= "INSERT INTO komentarze(id_ref, autor, tresc) values ('$id', '$autor', '$tresc')";
$wynik = $db->query($zapytanie);
echo "Added";
}else{
    echo "Problem";
}


?>

EDIT:
id_ref is not auto_increment field. The script is running on the localhost

  • 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-01T08:15:39+00:00Added an answer on June 1, 2026 at 8:15 am

    First of all, your form isn’t correct…name=”name”, class=”.response”??

    <form action="" method="post" >
        <input type="text" name="tekst" id="tekst"/><br/>
        <input type="text" name="autor" id="autor"/><br/>
        <input type="submit" name="id" value="Send" id="submit"/>
    </form>
    <div class="response"></div>
    

    Your PHP File should be”

    <?php
    $id = $_POST['id'];
    $autor= $_POST['autor'];
    $tresc = $_POST['tekst'];
    
    if(isset($id) && isset($autor) && isset($tresc)){
    include("db/connection.php");
    
    $zapytanie= "INSERT INTO komentarze(id_ref, autor, tresc) values ('$id', '$autor', '$tresc')";
    $wynik = $db->query($zapytanie);
    echo "Added";
    }else{
        echo "Problem";
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on this for some time. The script does work and
require_once does not seem to work. I am trying to use Zend libraries to
I can't seem to figure out how to get his bash script working. #!/bin/bash
This code does not seem to be working. I am trying to create a
The following does not seem to be working properly. success: function(results) { var $results
jQuery $.ajax() does not seem to work correctly with IE8 but it is working
How do I create an easy login script that does not require a database.
it seems that Markdown.NET does not escape the following: <script> which is kind of
I could use another pair of eyes. This script does what I want in
I have a PHP script that does the following: Uses file_get_contents() to get content

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.