28, May 2012

need other formelements like a radio - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: need other formelements like a radio
« previous next »
Pages: [1] Print

Author Topic: need other formelements like a radio  (Read 1276 times)
Metal slug addict
*
Posts: 18
132 credits
Members referred : 0


« on: Jun 27, 2006, 05:33:13 am »

Is this possible to add radio buttons to update_user_profile for field_1 etc. within the code that builds the form?
« Last Edit: Jun 27, 2006, 07:24:22 am by olaf »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jun 27, 2006, 07:22:49 am »

yes why not a radio button is just another form element. Or is this a request?
« Last Edit: Jun 27, 2006, 07:24:47 am by olaf »

Metal slug addict
*
Posts: 18
132 credits
Members referred : 0


« Reply #2 on: Jun 27, 2006, 03:58:20 pm »


I'd like to be able to add it myself using the functions that you already have. The create_ functions don't have a radio button though so I am just making a static button that gets updated when the rest of the record updates. Is there a ckeaner way to do this?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jun 27, 2006, 04:23:09 pm »

I created the two function to create the text field and area just as an example.

maybe you're able to use this snippet:
Code:
<?php
function 
create_radio_switch($formelement$first_val$second_val$gen_label ""$label_first ""$label_second ""$db_value ""$container_element ""$use_break false) {
$on " checked";
$off "";
$radio_group = ($container_element != "") ? "<".$container_element.">\n" "";
$radio_group .= ($gen_label != "") ? "  <label for=\"".$formelement."\">".$gen_label."</label>\n" "";
if (isset($_REQUEST[$formelement])) {
$checked $_REQUEST[$formelement];
} elseif (isset($db_value) && !isset($_REQUEST[$formelement])) {
$checked $db_value;
} else {
$checked "";
}
$first = ($checked == $first_val) ? " checked" "";
$second = ($first == " checked") ? "" " checked"
$radio_group .= ($label_first != "") ? "  ".$label_first "  "
$radio_group .= "<input name=\"".$formelement."\" type=\"radio\" value=\"".$first_val."\"".$first." style=\"border:0;\" />\n";
$radio_group .= ($label_second != "") ? "  ".$label_second "  "
$radio_group .= "<input name=\"".$formelement."\" type=\"radio\"value=\"".$second_val."\"".$second." style=\"border:0;\" />\n";
if ($use_break$radio_group .= "  <br />\n";
$radio_group .= ($container_element != "") ? "</".$container_element.">\n" "";
return $radio_group;        
}


the problems with radio's is that it's difficult to controle all of them inside one function, f.e. if you have more then x radio's you need a different design etc.

Metal slug addict
*
Posts: 18
132 credits
Members referred : 0


« Reply #4 on: Jun 27, 2006, 04:32:32 pm »

Thanks very much. I'll give it a try now!
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3043
Tags : design Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: need other formelements like a radio
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 01:38:36 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.