View Full Version : Get Javascript into a hidden PHP field

12-11-2009, 08:24 PM
I am trying to figure this out, you can see the sample of what I am working on here (http://www.comicracy.com/0111/300.php) , basically it's the star rating bar, the functionality is working as far as looks but what I need it to do is insert the value of the star clicked into a hidden field I have so that when the user clicks submit, it will upload this value to my database, don't have a clue what to do here but I am assuming it would be something I need to enter in this area of the script

<li class="current-rating" style="width:50%;">Currently 2.5/5 Stars.</li>
<li><a href="#" title="1 star out of 5" class="one-star">1</a></li>
<li><a href="#" title="2 stars out of 5" class="two-stars">2</a></li>
<li><a href="#" title="3 stars out of 5" class="three-stars">3</a></li>
<li><a href="#" title="4 stars out of 5" class="four-stars">4</a></li>
<li><a href="#" title="5 stars out of 5" class="five-stars">5</a></li>
<input name="hiddenFieldID" type="hidden" id="hiddenFieldID" value="0" /></td>
<td width="60" rowspan="2" valign="middle"><input name="rateSUBMIT" type="submit" id="rateSUBMIT" value="SUBMIT" />Any help would be greatly appreciated.

12-12-2009, 12:04 AM
i cant see that you would do this without a page refresh, so your links could carry a $_GET
such as
<a href="page.php?star=2"
then in your form collect the value as
<input name="hiddenFieldID" type="hidden" id="hiddenFieldID" value="<?php echo $-GET['star']; ?>" />

12-12-2009, 07:38 PM
This is working but I have changed it so it opens in a popup window which will have a submit button. Now can you tell me how to add more then one value to the link. For example I want the popup to say , voted "2" stars from username "sample", I tried to write the link as...

<a href="http://www.comicracy.com/ratingverifier.php?star=2?username=<?php echo $_SESSION['username']; ?>

but that just combined everything, I need them all as seperate values so I can insert it into the correct fields on the database table.

12-14-2009, 12:21 AM
?star=2& username=<?php echo $_SESSION['username']; ?> (http://www.comicracy.com/ratingverifier.php?star=2?username=)
use & the access as two values

12-14-2009, 10:48 AM

12-16-2009, 08:40 AM
Dyslexlia Relues KO !!