5 Replies - 1592 Views - Last Post: 08 November 2010 - 04:07 PM Rate Topic: -----

#1 Guest_GildedHermit*


Reputation:

Replace Radio Button with String

Posted 07 November 2010 - 11:15 PM

Quick problem - I have a group of radio buttons with the same name, but in different columns in a table. When I select one and click my submit button, I want only that radio button to be replaced with a String. Does anyone know a way to accomplish this?
Is This A Good Question/Topic? 0

Replies To: Replace Radio Button with String

#2 kinggeorge1987  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 130
  • Joined: 22-September 10

Re: Replace Radio Button with String

Posted 07 November 2010 - 11:25 PM

View PostGildedHermit, on 07 November 2010 - 10:15 PM, said:

Quick problem - I have a group of radio buttons with the same name, but in different columns in a table. When I select one and click my submit button, I want only that radio button to be replaced with a String. Does anyone know a way to accomplish this?


I think a little more information would make it easier to gain some assistance here. Perhaps the current code you have, what kind of string your wanting to implement into your button. i.e. Are you wanting to pull a value from the database ? Is it just a message dependent on which option they select ?
Was This Post Helpful? 0
  • +
  • -

#3 Guest_GildedHermit*


Reputation:

Re: Replace Radio Button with String

Posted 07 November 2010 - 11:34 PM

View Postkinggeorge1987, on 07 November 2010 - 10:25 PM, said:

View PostGildedHermit, on 07 November 2010 - 10:15 PM, said:

Quick problem - I have a group of radio buttons with the same name, but in different columns in a table. When I select one and click my submit button, I want only that radio button to be replaced with a String. Does anyone know a way to accomplish this?


I think a little more information would make it easier to gain some assistance here. Perhaps the current code you have, what kind of string your wanting to implement into your button. i.e. Are you wanting to pull a value from the database ? Is it just a message dependent on which option they select ?



Sorry - the way this works is the user selects 1 radio button out of a group of 12. The radio buttons are organized in a series of rows/columns within a table. After selecting a radio button, the user then enters their name in a text field at the bottom of the page and submits the information. The subsequent php file replaces only the selected radio button with the name that was entered in the text field on the previous page.

I would post the code, but the server I store my programs is temporarily down tonight for maintenance. I've been stuck on it for a while, and thought I'd see if anyone could lend some assistance.
Was This Post Helpful? 1

#4 kinggeorge1987  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 130
  • Joined: 22-September 10

Re: Replace Radio Button with String

Posted 08 November 2010 - 12:41 AM

Quote

Sorry - the way this works is the user selects 1 radio button out of a group of 12. The radio buttons are organized in a series of rows/columns within a table. After selecting a radio button, the user then enters their name in a text field at the bottom of the page and submits the information. The subsequent php file replaces only the selected radio button with the name that was entered in the text field on the previous page.

I would post the code, but the server I store my programs is temporarily down tonight for maintenance. I've been stuck on it for a while, and thought I'd see if anyone could lend some assistance.


Perhaps the Session function and Switch function could help you. You could eliminate the second PHP page by setting certain variables in your switch.

This is just a small example, not sure if it is exactly what your looking for - but maybe it will broaden your horizons a bit on one way to approach it.

<?php
//Start the session, this must be done on every page where you need to return the particular session value.
session_start();

//Check to see if the form has been submitted.
if ($_GET['value']){
	//If so, set the session variable to the name submitted from the form.
	switch($value){
		case "set":
		$_SESSION['label_1'] = $_POST['name'];
		break;
	}
}else{
	//If not, set the default value for the particular label. You can replace this with some arrays to handle multiple buttons.
	$_SESSION['label_1'] =""; //Default name
}

		
	?>		
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="test.php?value=set">

    <p>
      <label>
        <input type="radio" name="radio" id="button1" value="button1" />
        <?php session_start(); echo $_SESSION['label_1']; ?>
      </label>  
    </p>
    <p>
      
        <input type="text" name="name" id="name" />
      
      <input type="submit" name="button" id="button" value="Submit" />
    </p>
</form>
</body>
</html>


Was This Post Helpful? 1
  • +
  • -

#5 Guest_GildedHermit*


Reputation:

Re: Replace Radio Button with String

Posted 08 November 2010 - 10:53 AM

Thanks for the response, kinggeorge1987. Not quite what I'm looking for, but I definitely appreciate the help. If anyone else has any suggestions, I would love to hear them :)
Was This Post Helpful? 0

#6 kinggeorge1987  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 12
  • View blog
  • Posts: 130
  • Joined: 22-September 10

Re: Replace Radio Button with String

Posted 08 November 2010 - 04:07 PM

View PostGildedHermit, on 08 November 2010 - 09:53 AM, said:

Thanks for the response, kinggeorge1987. Not quite what I'm looking for, but I definitely appreciate the help. If anyone else has any suggestions, I would love to hear them :)


No problem, sorry I couldn't be of immediate help. If you get the chance to post the code of your form page, and of the php page, you would probably receive more responses. Your single description doesn't exactly give us enough information.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1