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

  • Home
  • SEARCH
  • 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 4103030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:54:21+00:00 2026-05-20T20:54:21+00:00

I am a newbie to mootools and web development also. I have read this

  • 0

I am a newbie to mootools and web development also. I have read this pretty cool blog
and I want to extend the code to connect with a database to update the rating with a php file. but unfortunately my code not working means database is not updating. Can someone please explain me why. Thanks a lot…

Here’s the code

star.html

<html>

<script src="mootools-1.3.js"></script> 
<script src="lorenzos-MooStarRating-422072a/Source/moostarrating.js"></script> 
<script> 

    // Configure the image paths
    var MooStarRatingImages = {
        defaultImageFolder: 'lorenzos-MooStarRating-422072a/Graphics/',
        defaultImageEmpty:  'star_empty.png',
        defaultImageFull:   'star_full.png',
        defaultImageHover:  "star_boxed_hover.png"
    };

    // Post iD
    var postId = 10;

    // When the DOM is ready....
    window.addEvent("domready",function() {

        // Create our instance
        // Advanced options
        var advancedRating = new MooStarRating({
            form: 'ratingsForm',
            radios: 'rating',
            half: false,
            //imageEmpty: 'star_boxed_empty.png',
            //imageFull:  'star_boxed_full.png',
            //imageHover: "star_boxed_hover.png", 
            width: 17, 
            tip: 'Rate <i>[VALUE] / 7.0</i>', 
            tipTarget: $('htmlTip'),
            tipTargetType: 'html', 
            click: function(value) {
                // Send ajax request to server
                new Request.send({
                    url: "rateSave.php",
                    data: {'rating': value}
                });
            }
        });



    });

</script> 

<form name="ratingsForm">
<label>Select The Number of Stars</label>
<input type="radio" name="rating" value="1.0" checked="checked">

<input type="radio" name="rating" value="2.0">

<input type="radio" name="rating" value="3.0">

<input type="radio" name="rating" value="4.0">

<input type="radio" name="rating" value="5.0">

<input type="radio" name="rating" value="6.0">

<input type="radio" name="rating" value="7.0">

<!--<input type="radio" name="rating" value="7.5">
<input type="radio" name="rating" value="8.0">
<input type="radio" name="rating" value="8.5">
<input type="radio" name="rating" value="9.0">
<input type="radio" name="rating" value="9.5">
<input type="radio" name="rating" value="10.0">-->



<span id="htmlTip"></span>
</form>

</html>

rateSave.php

<?php

$con = mysql_connect("localhost","root","");
if (!$con){
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("rating", $con);

$starCount =$_POST['rating'];

$result=mysql_query("INSERT INTO star VALUES('hotel','$starCount')");



mysql_close($con);

?>
  • 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-20T20:54:22+00:00Added an answer on May 20, 2026 at 8:54 pm

    Hi Pavithra Gunasekara, the error is ‘nothing’, here :

    click: function(value) {
    // Send ajax request to server ...
    }
    

    instead of ‘click’, the name of the CallBack function is onClick i.e.

    onClick: function(value) {
    // Send ajax request to server ...
    }
    

    about the ‘click’, you could do this way i.e.

    advancedRating.addEvent('click', function(){ new Request.send({/* ... */}) });
    

    working example with ‘onClick’ instead of the ‘click’ inside the new instance definition: http://jsfiddle.net/steweb/LDw4y/

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

Sidebar

Related Questions

Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Newbie here...can I write one program which incorporates .NET LINQ and also various Java
Java Newbie here. I have a JFrame that I added to my netbeans project,
Total newbie question but this is driving me mad! I'm trying this: myInt =
I'm a newbie to pgsql. I have few questionss on it: 1) I know
Sorry for the second newbie question, I'm a developer not a sysadmin so this
Newbie IIS question: I want to setup HTTPS access for my XHTML page (not
Newbie question. Looking at arrays (ie: dynamically sized) this works: NSArray *array; array =
Newbie question. I’m writing an ASP.Net MVC app in VB.Net and have been using
Newbie question... The objective: I intend to have an HTML text input field as

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.