logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 12-11-2009, 09:24 PM   #1
woofy
woofy's Avatar
 
Join Date: Dec 2007
Location: San Diego
Posts: 57
Default Get Javascript into a hidden PHP field

I am trying to figure this out, you can see the sample of what I am working on here , 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

Code:
<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>
                  </ul>
                    <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.
woofy is offline   Reply With Quote
Old 12-12-2009, 01:04 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

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']; ?>" />
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 12-12-2009, 08:38 PM   #3
woofy
woofy's Avatar
 
Join Date: Dec 2007
Location: San Diego
Posts: 57
Default

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...

Code:
<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.
woofy is offline   Reply With Quote
Old 12-14-2009, 01:21 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

?star=2& username=<?php echo $_SESSION['username']; ?>
use & the access as two values
$GET_['star']
$GET_['username']
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 12-14-2009, 11:48 AM   #5
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

$_GET['star']
$_GET['username']
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 12-16-2009, 09:40 AM   #6
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

ah
Dyslexlia Relues KO !!
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:36 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com