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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:27:52+00:00 2026-06-14T12:27:52+00:00

I’m trying to make a star rating system and i can’t get to insert

  • 0

I’m trying to make a star rating system and i can’t get to insert the results into mysql. I’m missing something but I don’t know what. I will show you my code, maybe one of you can see where is the issue.
Thanks in advance!

First, my form:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head> 
 <script src='jquery.js' type="text/javascript"></script>
 <script src='documentation/documentation.js' type="text/javascript"></script>
 <link href='documentation/documentation.css' type="text/css" rel="stylesheet"/>
 <script type="text/javaScript" src="documentation/chili/jquery.chili-2.0.js"></script> 
 <script type="text/javascript">try{ChiliBook.recipeFolder="documentation/chili/"}catch(e){}</script>
 <script src='jquery.MetaData.js' type="text/javascript" language="javascript"></script>
 <script src='jquery.rating.js' type="text/javascript" language="javascript"></script>
 <link href='jquery.rating.css' type="text/css" rel="stylesheet"/>
</head>

<body>
<div id="tab-Testing">
<script>
$('form1').submit(function() {
 var ans=$(this).serialize();
  $.ajax({
  type: "POST",
   url: "starsubmit.php",
  data:ans
 }).done(function( msg ) {
 alert( "Data Saved: " + msg );
 });
 return false;
});
</script>

<div class="Clear">&nbsp;</div>
<form id="form1">

        Question 1:bla bla bla

   <input class="star required" type="radio" name="Question 1" value="1"/>
    <input class="star" type="radio" name="Question 1" value="2"/>
    <input class="star" type="radio" name="Question 1" value="3"/>
    <input class="star" type="radio" name="Question 1" value="4"/>
    <input class="star" type="radio" name="Question 1" value="5"/>
   </div>
   <br/>
   <div class="Clear">

        Question 2:bla bla bla

    <input class="star required" type="radio" name="Question 2" value="1"/>
    <input class="star" type="radio" name="Question 2" value="2"/>
    <input class="star" type="radio" name="Question 2" value="3"/>
    <input class="star" type="radio" name="Question 2" value="4"/>
    <input class="star" type="radio" name="Question 2" value="5"/>
   </div>
   <br/>
   <div class="Clear">

        Question 3:bla bla bla

    <input class="star required" type="radio" name="Question 3" value="1"/>
    <input class="star" type="radio" name="Question 3" value="2"/>
    <input class="star" type="radio" name="Question 3" value="3"/>
    <input class="star" type="radio" name="Question 3" value="4"/>
    <input class="star" type="radio" name="Question 3" value="5"/>
   </div>
 <br>
   <div class="Clear">

        Question 4:bla bla bla

    <input class="star required" type="radio" name="Question 4" value="1" />
    <input class="star" type="radio" name="Question 4" value="2" />
    <input class="star" type="radio" name="Question 4" value="3" />
    <input class="star" type="radio" name="Question 4" value="4" />
    <input class="star" type="radio" name="Question 4" value="5" />
   </div>
   <br/>
   <div class="Clear">

        Question 5:bla bla bla

    <input class="star required" type="radio" name="Question 5" value="1"/>
    <input class="star" type="radio" name="Question 5" value="2"/>
    <input class="star" type="radio" name="Question 5" value="3"/>
    <input class="star" type="radio" name="Question 5" value="4"/>
    <input class="star" type="radio" name="Question 5" value="5"/>
   </div>
   <br/>
   <div class="Clear">

        Question 6:bla bla bla

    <input class="star required" type="radio" name="Question 6" value="1" />
    <input class="star" type="radio" name="Question 6" value="2" />
    <input class="star" type="radio" name="Question 6" value="3" />
    <input class="star" type="radio" name="Question 6" value="4" />
    <input class="star" type="radio" name="Question 6" value="5" />
   </div>

   <input type="submit" value="Submit scores!" />  </td>

</form>
</body>
</html>

Now, my starsubmit.php:

<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "cosmote";
$prefix = "";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Opps some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong");
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$question1 = mysql_real_escape_string($_POST['question1']);
$question2 = mysql_real_escape_string($_POST['question2']);
$question3 = mysql_real_escape_string($_POST['question3']);
$question4 = mysql_real_escape_string($_POST['question4']);
$question5 = mysql_real_escape_string($_POST['question5']);
$question6 = mysql_real_escape_string($_POST['question6']);

mysql_query("INSERT INTO answers (q1,q2,q3,q4,q5,q6) VALUES ('$question1','$question2','$question3','$question4','$question5','$question6')");
echo "<h1>Thank You !</h1>";
}

?>

And, finally, my table:

CREATE TABLE IF NOT EXISTS `answers` (
  `q1` int(3) NOT NULL,
  `q2` int(3) NOT NULL,
  `q3` int(3) NOT NULL,
  `q4` int(3) NOT NULL,
  `q5` int(3) NOT NULL,
  `q6` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  • 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-14T12:27:53+00:00Added an answer on June 14, 2026 at 12:27 pm

    i must say this should be :

    $('form1').submit(function() { // <------you are not submiting the specific form 
    

    like this:

    $('#form1').submit(function() { // <------ every id should have a '#' in jquery
    

    this might be the issue if you can change your .done function

    .done(function() {  
       alert( "Data Saved");  // try removing the passed param "msg"
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:

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.