473,395 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

change value of a php variable

pradeepjain
563 512MB
Expand|Select|Wrap|Line Numbers
  1. for ($i = 1 ; $i < $count; $i++){
  2. for($k = 1; $k <= 10; $k++){
  3. if($tocheck == $k){
  4. $chk = "checked";
  5. }
  6. else
  7. {
  8. $chk = "";
  9. }
  10.  
  11. $myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."".$k."' value='". $k ."' $disabled  $chk  title='". $k." out of 10 '/>&nbsp;&nbsp;";
  12.  
  13. }
  14. $myresult .= "</span>";
  15. $myresult .= "<input type=\"button\" value=\"Rate It\" onclick=\"javascript: $('.hide".$i."').show('show');\" >";
  16. }
  17.  

when i click on the Rate it button. the value of all the radiobuttons should become 0 . i.e the $chk must become NULL . how can i achieve this using javascript/ajax/jquery method ?
Jan 15 '10 #1
2 3396
pradeepjain
563 512MB
i could solve this by using jquery ! thanks for the help!
Jan 15 '10 #2
acoder
16,027 Expert Mod 8TB
If you're thinking of changing the PHP variable, the approach is incorrect. The page has loaded, so JavaScript on the client doesn't have access to PHP variables. Either you can make an Ajax request to a PHP script which reproduces the default radio buttons which you can use to replace the ones on the page, or the better method would be to just loop over the radio buttons on the page and change their values using JavaScript.
Jan 15 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
3
by: Byron | last post by:
Hi, Javascript confuses me, so I usually limit myself to Dreamweaver's built-in scripts for stuff like imageswaps. But this time I'm trying to write something very simple myself. I do most of my...
1
by: Varadha | last post by:
Hi, I am declaring a variable static char Version_No = '1' in header file header.h In a application "app.exe", i am changing the value of the variable in to '2' In the same application i am...
0
by: Anonieko Ramos | last post by:
Answer. Use IHttpHandler. thanks Ro ry for coming up with this code. It processes css file to add variables. neat idea using System; using System.IO; using System.Text; using...
4
by: Shapper | last post by:
Hello, I have this image in my HTML code: <img src="images/en-US/myImage.jpg" /> I want to change the URL using the value of a Session variable. <img src="images/ Session("culture") Value...
0
by: josemario.hernandez | last post by:
Hi, I'm having a issue trying to change the value of a session variable. It seems like I just can set my session variable one time in the sessión. For example if I write: Session("Variable") =...
5
by: Maxwell2006 | last post by:
Hi, Can I have a breakpoint that stop execution as soon as any code change the value of a specific variable? Thank you, Max
3
by: vatsa | last post by:
Hi all, we can simply change value of PS1 from command prompt . but I want to change the value of PS1 from within a c program. i tried to do that using getenv & putenv. but it is n't...
7
by: dotnetnoob | last post by:
i keep getting Object references not set to an instance of an object from this code: Private Sub EqBinding() Dim x As Integer x = 0 Do If CStr(arlsType.Item(x)) = "Bacnet Point" Then Dim...
3
by: tc | last post by:
I'm trying to put together a small control. It's not, but for arguments sake, let's say it's a progress bar. The user will make a change to a setting, lets call it 'value'. I want to trap the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.