Results 1 to 4 of 4

Thread: display div with radio buttons

  1. #1
    Join Date
    Apr 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default display div with radio buttons

    I would like to have 2 radio buttons on one page "ON" and "OFF" and when "ON" is selected contents of a div is displayed on another page. When the user selects "OFF" the div contents goes away..
    Can anyone help..I have searched and found something simmilar http://jsfiddle.net/3sdk8/1/ but i dont know how to set it up..on two pages

    Thank you for any help

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,951
    Thanks
    43
    Thanked 3,195 Times in 3,157 Posts
    Blog Entries
    12

    Default

    The jsfiddle you linked to is in javascript. But you have posted in the PHP forum.

    Do you want a javascript or a PHP solution?
    When you say "another page", do you mean another page that is loaded from the page with the radio buttons, or another page that's already open in the browser?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the quick reply ... OK, I have an admin page and a customer page...on the admin page I would like to have the radio buttons and when selected the content to be displayed on the customer page... I dont have a preference of PHP or JavaScript... any help is appreciated ..

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,951
    Thanks
    43
    Thanked 3,195 Times in 3,157 Posts
    Blog Entries
    12

    Default

    I take it that the admin page's access is limited to just you and/or someone else running the site. And the customer page would be viewed by an at least potentially larger audience. If so you could, using javascript and PHP, have the act of checking a radio write/overwrite a file on the server. Then, as the customer page loads it could, using just PHP, check the contents of the file that was written to see what state the radio buttons last had and on that basis show or not show certain content to the customer, also - when the admin page next loads it could also read the file, to know which radio should currently be checked. If this is the situation and sounds like what you're after, I will make you some sample pages to show you how to do that.

    Keep in mind that the admin page would not be able to change* the customer page if it was currently being viewed by a client when a different radio was checked. But the next time anyone viewed the customer page or if the current person were to refresh it, that would then change whether or not it would show this optional content.

    The optional content could be on the customer page, or in a separate file. Regardless of where it's kept, it could not be seen unless the radio on the admin page that determines its state that allows it to be seen is checked. Otherwise it would be hidden by PHP, which would require server access to see it.


    *It could, if the customer page were to be actively polling for a change in the flag file. However, that would require the client viewing the customer page to have javascript enabled. You cannot count on that unless you deny access to the customer page unless the client has javascript enabled. Even then, someone might be able to get around that.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. radio buttons not working.
    By ShadowIce in forum JavaScript
    Replies: 4
    Last Post: 10-30-2009, 12:04 PM
  2. Radio buttons
    By bobneedshelp in forum Looking for such a script or service
    Replies: 0
    Last Post: 09-05-2009, 10:03 PM
  3. Help with Radio buttons
    By MSK7 in forum PHP
    Replies: 2
    Last Post: 08-24-2009, 03:06 PM
  4. Aligning Radio Buttons
    By junestag in forum CSS
    Replies: 3
    Last Post: 06-29-2009, 04:40 PM
  5. Radio Buttons
    By Freeman in forum HTML
    Replies: 1
    Last Post: 10-25-2005, 10:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •