-3
<input class="stars" type="radio" id="star5" onclick="myFunction('Overall rating:',5)" name="rating" value="5" />
<label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input class="stars" type="radio" id="star4" onclick="myFunction('Overall rating:',4)" name="rating" value="4" />
<label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input class="stars" type="radio" id="star3" onclick="myFunction('Overall rating:',3)" name="rating" value="3" />
<label class = "full" for="star3" title="Meh - 3 stars"></label>
<input class="stars" type="radio" id="star2" onclick="myFunction('Overall rating:',2)" name="rating" value="2" />
<label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input class="stars" type="radio" id="star1" onclick="myFunction('Overall rating:',1)" name="rating" value="1" />
<label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<font  size="4"color="#ffffff">Overall rating:</font>

How do I pass js parameter value in database using php?

4
  • I don't understand anything, what do you want? Commented Apr 6, 2016 at 11:25
  • Can you show us what you've tried to get this working? Commented Apr 6, 2016 at 11:26
  • <script> function myFunction(x, y) { alert (x); $.post('rating.php',{'category':x,'rating':y},function(d){ alert('hello'+d); }) } Commented Apr 6, 2016 at 11:27
  • i have a html code where i create a onclick function and pass 2 perameter and get it on js faction i need to pass these perameter value php that will help me to insert into database Commented Apr 6, 2016 at 11:29

2 Answers 2

0

Onchange() of radio button call an ajax function, which will store your response in database.

Sign up to request clarification or add additional context in comments.

Comments

0

By using ajax

function myFunction(yourString, value) {
    $.get('updatePage.php', { 'yourkeyString': yourString, 'yourValue': value }, function (d) { alert('Hello from PHP: ' + d); });
}

Can check this answer also https://stackoverflow.com/a/712378/6124249

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.