473,735 Members | 2,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php and Javascript call to change radio button

I am trying to set the state of a radio button. I do not see what I am
doing wrong. Sorry, I am new at this.. I need another set of eyes to
look at this snip of code. I am trying to set the radio button with this
link of code:

echo 'SCRIPT language=JavaSc ript
setCheckedValue ("'.$_SESSIO N['abbr_letter'].'");</SCRIPT>'; //?

<snip of code>

<?php
session_start() ;
if(!isset($_SES SION['abbr_letter'])) {
$_SESSION['abbr_letter'] = 'A';
}
require_once 'includes/config.inc.php' ;
require_once 'includes/header.inc.php' ;

if (xdebug_is_enab led())
echo "enable";
else
xdebug_enable() ;

//
// Start a Form
?>
<HTML>
<HEAD>
<link href="quotesCss .css" rel="stylesheet " type="text/css">
<SCRIPT TYPE="text/javascript">
<!--
// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue (newValue) {
var len = document.author _abbrv.abbr_let ter.length
for(var i = 0; i < len; i++)
{
document.author _abbrv.abbr_let ter[i].checked = false;
if(document.aut hor_abbrv.abbr_ letter[i].value ==
newValue.toStri ng())
{
document.author _abbrv.abbr_let ter[i].checked = true;
}
}
}
-->
</SCRIPT>
</HEAD>
<b><FORM NAME="author_ab brv" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<table>
<tr>
<td><input type="radio" name="abbr_lett er" value="A"
onclick="submit ()"A </td>
<td><input type="radio" name="abbr_lett er" value="B"
onclick="submit ()"B </td>
<td><input type="radio" name="abbr_lett er" value="C"
onclick="submit ()"C </td>
<td><input type="radio" name="abbr_lett er" value="D"
onclick="submit ()"D </td>
<td><input type="radio" name="abbr_lett er" value="E"
onclick="submit ()"E </td>
<td><input type="radio" name="abbr_lett er" value="F"
onclick="submit ()"F </td>
<td><input type="radio" name="abbr_lett er" value="G"
onclick="submit ()"G </td>
<td><input type="radio" name="abbr_lett er" value="H"
onclick="submit ()"H </td>
<td><input type="radio" name="abbr_lett er" value="I"
onclick="submit ()"I </td>
<td><input type="radio" name="abbr_lett er" value="J"
onclick="submit ()"J </td>
<td><input type="radio" name="abbr_lett er" value="K"
onclick="submit ()"K </td>
<td><input type="radio" name="abbr_lett er" value="L"
onclick="submit ()"L </td>
<td><input type="radio" name="abbr_lett er" value="M"
onclick="submit ()"M </td>
</tr>
<tr>
<td><input type="radio" name="abbr_lett er" value="N"
onclick="submit ()"N </td>
<td><input type="radio" name="abbr_lett er" value="O"
onclick="submit ()"O </td>
<td><input type="radio" name="abbr_lett er" value="P"
onclick="submit ()"P </td>
<td><input type="radio" name="abbr_lett er" value="Q"
onclick="submit ()"Q </td>
<td><input type="radio" name="abbr_lett er" value="R"
onclick="submit ()"R </td>
<td><input type="radio" name="abbr_lett er" value="S"
onclick="submit ()"S </td>
<td><input type="radio" name="abbr_lett er" value="T"
onclick="submit ()"T </td>
<td><input type="radio" name="abbr_lett er" value="U"
onclick="submit ()"U </td>
<td><input type="radio" name="abbr_lett er" value="V"
onclick="submit ()"V </td>
<td><input type="radio" name="abbr_lett er" value="W"
onclick="submit ()"W </td>
<td><input type="radio" name="abbr_lett er" value="X"
onclick="submit ()"X </td>
<td><input type="radio" name="abbr_lett er" value="Y"
onclick="submit ()"Y </td>
<td><input type="radio" name="abbr_lett er" value="Z"
onclick="submit ()"Z </td>
</tr>
</TABLE>
</FORM>
<b><FORM NAME="author" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<SELECT NAME="author_pk " SIZE="20" COLS="10" onclick="submit ()">

<?php
//
//Check for the first time pass
if( !isset($_POST['abbr_letter']) ) {
$_POST['abbr_letter'] = $_SESSION['abbr_letter'];
}
//
//Store the latest selected option to the Session var
$_SESSION['abbr_letter'] = $_POST['abbr_letter'];
echo 'SCRIPT language=JavaSc ript
setCheckedValue ("'.$_SESSIO N['abbr_letter'].'");</SCRIPT>'; //?

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 15 '06 #1
10 6100
VK

IchBin wrote:
I am trying to set the state of a radio button. I do not see what I am
doing wrong.
PHP is executed server-side; JavaScript is executed client-side. That
would be most helpful:
1) To know what exactly "wrong" in your case (radio button states do
not change; they change but on wrong buttons; browser crashes;
something else)
2) To see the page as it is at the moment of the JavaScript code
execution (thus served from the server to the user-agent). For this
generate HTML output out of your PHP (<http>...</http>) and post it
here.

Sorry, I am new at this.. I need another set of eyes to
look at this snip of code. I am trying to set the radio button with this
link of code:

echo 'SCRIPT language=JavaSc ript
setCheckedValue ("'.$_SESSIO N['abbr_letter'].'");</SCRIPT>'; //?

<snip of code>

<?php
session_start() ;
if(!isset($_SES SION['abbr_letter'])) {
$_SESSION['abbr_letter'] = 'A';
}
require_once 'includes/config.inc.php' ;
require_once 'includes/header.inc.php' ;

if (xdebug_is_enab led())
echo "enable";
else
xdebug_enable() ;

//
// Start a Form
?>
<HTML>
<HEAD>
<link href="quotesCss .css" rel="stylesheet " type="text/css">
<SCRIPT TYPE="text/javascript">
<!--
// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue (newValue) {
var len = document.author _abbrv.abbr_let ter.length
for(var i = 0; i < len; i++)
{
document.author _abbrv.abbr_let ter[i].checked = false;
if(document.aut hor_abbrv.abbr_ letter[i].value ==
newValue.toStri ng())
{
document.author _abbrv.abbr_let ter[i].checked = true;
}
}
}
-->
</SCRIPT>
</HEAD>
<b><FORM NAME="author_ab brv" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<table>
<tr>
<td><input type="radio" name="abbr_lett er" value="A"
onclick="submit ()"A </td>
<td><input type="radio" name="abbr_lett er" value="B"
onclick="submit ()"B </td>
<td><input type="radio" name="abbr_lett er" value="C"
onclick="submit ()"C </td>
<td><input type="radio" name="abbr_lett er" value="D"
onclick="submit ()"D </td>
<td><input type="radio" name="abbr_lett er" value="E"
onclick="submit ()"E </td>
<td><input type="radio" name="abbr_lett er" value="F"
onclick="submit ()"F </td>
<td><input type="radio" name="abbr_lett er" value="G"
onclick="submit ()"G </td>
<td><input type="radio" name="abbr_lett er" value="H"
onclick="submit ()"H </td>
<td><input type="radio" name="abbr_lett er" value="I"
onclick="submit ()"I </td>
<td><input type="radio" name="abbr_lett er" value="J"
onclick="submit ()"J </td>
<td><input type="radio" name="abbr_lett er" value="K"
onclick="submit ()"K </td>
<td><input type="radio" name="abbr_lett er" value="L"
onclick="submit ()"L </td>
<td><input type="radio" name="abbr_lett er" value="M"
onclick="submit ()"M </td>
</tr>
<tr>
<td><input type="radio" name="abbr_lett er" value="N"
onclick="submit ()"N </td>
<td><input type="radio" name="abbr_lett er" value="O"
onclick="submit ()"O </td>
<td><input type="radio" name="abbr_lett er" value="P"
onclick="submit ()"P </td>
<td><input type="radio" name="abbr_lett er" value="Q"
onclick="submit ()"Q </td>
<td><input type="radio" name="abbr_lett er" value="R"
onclick="submit ()"R </td>
<td><input type="radio" name="abbr_lett er" value="S"
onclick="submit ()"S </td>
<td><input type="radio" name="abbr_lett er" value="T"
onclick="submit ()"T </td>
<td><input type="radio" name="abbr_lett er" value="U"
onclick="submit ()"U </td>
<td><input type="radio" name="abbr_lett er" value="V"
onclick="submit ()"V </td>
<td><input type="radio" name="abbr_lett er" value="W"
onclick="submit ()"W </td>
<td><input type="radio" name="abbr_lett er" value="X"
onclick="submit ()"X </td>
<td><input type="radio" name="abbr_lett er" value="Y"
onclick="submit ()"Y </td>
<td><input type="radio" name="abbr_lett er" value="Z"
onclick="submit ()"Z </td>
</tr>
</TABLE>
</FORM>
<b><FORM NAME="author" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<SELECT NAME="author_pk " SIZE="20" COLS="10" onclick="submit ()">

<?php
//
//Check for the first time pass
if( !isset($_POST['abbr_letter']) ) {
$_POST['abbr_letter'] = $_SESSION['abbr_letter'];
}
//
//Store the latest selected option to the Session var
$_SESSION['abbr_letter'] = $_POST['abbr_letter'];
echo 'SCRIPT language=JavaSc ript
setCheckedValue ("'.$_SESSIO N['abbr_letter'].'");</SCRIPT>'; //?

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 15 '06 #2
VK wrote:
IchBin wrote:
>I am trying to set the state of a radio button. I do not see what I am
doing wrong.

PHP is executed server-side; JavaScript is executed client-side. That
would be most helpful:
1) To know what exactly "wrong" in your case (radio button states do
not change; they change but on wrong buttons; browser crashes;
something else)
2) To see the page as it is at the moment of the JavaScript code
execution (thus served from the server to the user-agent). For this
generate HTML output out of your PHP (<http>...</http>) and post it
here.
Sorry all works, app wise, it is just the radio buttons do not stay
selected after selecting one once coming back from the server.. I do
post the button that is changed (Have echo'ed that value so I know I
trapped it, and trying to reset to that selected button.

The actual running code is here: http://ichbin.9999mb.com

Not sure how I can trap the the generated HTML code coming back from the
server..

Here is the entire script:

<?php
/**
*
http://localhost/quotes/quotesCss.ph...RT=tswebeditor
*
* @version $Id$
* @copyright 2006 weconsultants, http://weconsultants.phpnet.us
*/
session_start() ;
if(!isset($_SES SION['abbr_letter'])) {
$_SESSION['abbr_letter'] = 'A';
// echo 'setCheckedValu e("abbr_letter" ,
"'.$_SESSIO N['abbr_letter'].'")';
}
require_once 'includes/config.inc.php' ;
require_once 'includes/header.inc.php' ;

if (xdebug_is_enab led())
echo "enable";
else
xdebug_enable() ;

//
// Start a Form
?>
<HTML>
<HEAD>
<link href="quotesCss .css" rel="stylesheet " type="text/css">
<SCRIPT TYPE="text/javascript">
<!--
// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue (newValue) {
var len = document.author _abbrv.abbr_let ter.length
for(var i = 0; i < len; i++)
{
document.author _abbrv.abbr_let ter[i].checked = false;
if(document.aut hor_abbrv.abbr_ letter[i].value ==
newValue.toStri ng())
{
document.author _abbrv.abbr_let ter[i].checked = true;
}
}
}
-->
</SCRIPT>
</HEAD>
<b><FORM NAME="author_ab brv" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<table>
<tr>
<td><input type="radio" name="abbr_lett er" value="A"
onclick="submit ()"A </td>
<td><input type="radio" name="abbr_lett er" value="B"
onclick="submit ()"B </td>
<td><input type="radio" name="abbr_lett er" value="C"
onclick="submit ()"C </td>
<td><input type="radio" name="abbr_lett er" value="D"
onclick="submit ()"D </td>
<td><input type="radio" name="abbr_lett er" value="E"
onclick="submit ()"E </td>
<td><input type="radio" name="abbr_lett er" value="F"
onclick="submit ()"F </td>
<td><input type="radio" name="abbr_lett er" value="G"
onclick="submit ()"G </td>
<td><input type="radio" name="abbr_lett er" value="H"
onclick="submit ()"H </td>
<td><input type="radio" name="abbr_lett er" value="I"
onclick="submit ()"I </td>
<td><input type="radio" name="abbr_lett er" value="J"
onclick="submit ()"J </td>
<td><input type="radio" name="abbr_lett er" value="K"
onclick="submit ()"K </td>
<td><input type="radio" name="abbr_lett er" value="L"
onclick="submit ()"L </td>
<td><input type="radio" name="abbr_lett er" value="M"
onclick="submit ()"M </td>
</tr>
<tr>
<td><input type="radio" name="abbr_lett er" value="N"
onclick="submit ()"N </td>
<td><input type="radio" name="abbr_lett er" value="O"
onclick="submit ()"O </td>
<td><input type="radio" name="abbr_lett er" value="P"
onclick="submit ()"P </td>
<td><input type="radio" name="abbr_lett er" value="Q"
onclick="submit ()"Q </td>
<td><input type="radio" name="abbr_lett er" value="R"
onclick="submit ()"R </td>
<td><input type="radio" name="abbr_lett er" value="S"
onclick="submit ()"S </td>
<td><input type="radio" name="abbr_lett er" value="T"
onclick="submit ()"T </td>
<td><input type="radio" name="abbr_lett er" value="U"
onclick="submit ()"U </td>
<td><input type="radio" name="abbr_lett er" value="V"
onclick="submit ()"V </td>
<td><input type="radio" name="abbr_lett er" value="W"
onclick="submit ()"W </td>
<td><input type="radio" name="abbr_lett er" value="X"
onclick="submit ()"X </td>
<td><input type="radio" name="abbr_lett er" value="Y"
onclick="submit ()"Y </td>
<td><input type="radio" name="abbr_lett er" value="Z"
onclick="submit ()"Z </td>
</tr>
</TABLE>
</FORM>
<b><FORM NAME="author" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<SELECT NAME="author_pk " SIZE="20" COLS="10" onclick="submit ()">

<?php
//
//Check for the first time pass
if( !isset($_POST['abbr_letter']) ) {
$_POST['abbr_letter'] = $_SESSION['abbr_letter'];
}
//
//Store the lastest selected option to the Session var
$_SESSION['abbr_letter'] = $_POST['abbr_letter'];
echo 'SCRIPT language=JavaSc ript
setCheckedValue ("'.$_SESSIO N['abbr_letter'].'");</SCRIPT>'; //?
//
//Setup for the database call for authors by first letter
$sqlcmd = $author_detail_ select_by_Lette r . $_POST['abbr_letter']
. $author_detail_ orderBy;
if ($result = mysql_query($sq lcmd))
{
while ($row = mysql_fetch_obj ect($result))
{
printf("<option value='%d'>%s %s, %s %s %s</option>n",
$row->id, $row->TITLE, $row->lastname,
$row->firstname, $row->middlename, $row->SUFFIX);
}
mysql_free_resu lt($result);
}
else
{
die('Database Error: ' . $mysql->error);
exit;
}
?>
</SELECT>
<?php
//
// Add the list of top 20 authors
require_once 'top20.php';
?>
</FORM>

<BODY>
<?php
//
// This form uses the POST method, so process any post selections here
if( isset($_POST['author_pk']) )
{
//
// Log what author the user is looking for to the DB
include 'quoteLogging.p hp';
//
// Get all of the Quotes associated with this author
$sqlcmd = $author_detail_ select . $_POST['author_pk'];
if ($author_detail = mysql_query($sq lcmd))
{
while( $row = mysql_fetch_obj ect($author_det ail) )
{
printf('<span style="font-weight: bold;">%s %s, %s %s
%s </span>' .
' %s <br<div style="margin-left: 80px;">%s '.
'<span style="font-weight: bold;"></div><br>'.
'<div style="margin-left: 80px;"><span
style="font-weight: bold;">' .
" Link: </span><a href='%s'Author s detail
information</a></span></div><br>",
$row->TITLE, $row->lastname,
$row->firstname, $row->middlename, $row->SUFFIX,
$row->BIRTHDEATH,$ro w->DESCRIPTION,$r ow->LINK);
}
}
else
{
die('Database Error: ' . mysql_error());
exit;
}
//
// Select the number of Quotes the selected author has.
$sqlcmd = $author_quote_n umber . $_POST['author_pk'];
if ($numberOfQuote s = mysql_query($sq lcmd))
{
$row = mysql_fetch_obj ect($numberOfQu otes);
printf( '<div style="margin-left: 80px;"><span
style="font-weight: bold;">'.
'Number of Quotes: </span%s<br>',
number_format($ row->COUNT) .
' </div>');
}
else
{
die('Database Error: ' . mysql_error());
exit;
}
//
//
$sqlcmd = $author_quote_s elect . $_POST['author_pk'] . " ORDER
BY quote;";
if ($resultSet = mysql_query($sq lcmd))
{
while( $row = mysql_fetch_obj ect($resultSet) )
{
printf('<span style="font-weight:
bold;background-color: white;">Quote:</span%s<br>',
$row->QUOTE);
if ($row->QUOTELITREF != '' )
{
printf( '<span style="font-weight: bold;
background-color: white;">'.
'Quote Reference:</span%s<br><br>' ,
$row->QUOTELITREF) ;
}
else
{
print('<br>');
}
}
}
else
{
mysql_free_resu lt($result);
die('Database Error==' . mysql_error());
exit;
}
}
//
// Add a footer for all to know
require_once 'includes/footer.inc.php' ;
//
// Close DB
include 'includes/closedb.inc.php ';
?>

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 15 '06 #3
VK

IchBin wrote:
The actual running code is here: http://ichbin.9999mb.com
Not sure how I can trap the the generated HTML code coming back from the
server..
The URL (as seen in browser) *is* the HTML code coming back from the
server :-) This is what I meant, thank you.

In your case the page starts from <centertag and after a bunch of
other code (inscluding script) there is finally <htmlblock wrapped
into <div>. I'm very far of being a pedantical person here, but some
*very minimum* respect to basic programming rules has to be served in
any solution IMHO. Try do not get upset: but your pages are totally
dependant on the particular UA's error correction mechanics - this way
some generic advises are futile.
I just say that if your bring you pages into a descent form the problem
very well may disappear by itself. You may just try.

Nov 15 '06 #4

IchBin wrote:
I am trying to set the state of a radio button. I do not see what I am
doing wrong. Sorry, I am new at this.. I need another set of eyes to
look at this snip of code. I am trying to set the radio button with this
link of code:

echo 'SCRIPT language=JavaSc ript
setCheckedValue ("'.$_SESSIO N['abbr_letter'].'");</SCRIPT>'; //?

<snip of code>

<?php
session_start() ;
if(!isset($_SES SION['abbr_letter'])) {
$_SESSION['abbr_letter'] = 'A';
}
require_once 'includes/config.inc.php' ;
require_once 'includes/header.inc.php' ;

if (xdebug_is_enab led())
echo "enable";
else
xdebug_enable() ;

//
// Start a Form
?>
<HTML>
<HEAD>
<link href="quotesCss .css" rel="stylesheet " type="text/css">
<SCRIPT TYPE="text/javascript">
<!--
// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue (newValue) {
var len = document.author _abbrv.abbr_let ter.length
for(var i = 0; i < len; i++)
{
document.author _abbrv.abbr_let ter[i].checked = false;
if(document.aut hor_abbrv.abbr_ letter[i].value ==
newValue.toStri ng())
{
document.author _abbrv.abbr_let ter[i].checked = true;
}
}
}
-->
</SCRIPT>
</HEAD>
<b><FORM NAME="author_ab brv" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<table>
<tr>
<td><input type="radio" name="abbr_lett er" value="A"
onclick="submit ()"A </td>
<td><input type="radio" name="abbr_lett er" value="B"
onclick="submit ()"B </td>
<td><input type="radio" name="abbr_lett er" value="C"
onclick="submit ()"C </td>
<td><input type="radio" name="abbr_lett er" value="D"
onclick="submit ()"D </td>
<td><input type="radio" name="abbr_lett er" value="E"
onclick="submit ()"E </td>
<td><input type="radio" name="abbr_lett er" value="F"
onclick="submit ()"F </td>
<td><input type="radio" name="abbr_lett er" value="G"
onclick="submit ()"G </td>
<td><input type="radio" name="abbr_lett er" value="H"
onclick="submit ()"H </td>
<td><input type="radio" name="abbr_lett er" value="I"
onclick="submit ()"I </td>
<td><input type="radio" name="abbr_lett er" value="J"
onclick="submit ()"J </td>
<td><input type="radio" name="abbr_lett er" value="K"
onclick="submit ()"K </td>
<td><input type="radio" name="abbr_lett er" value="L"
onclick="submit ()"L </td>
<td><input type="radio" name="abbr_lett er" value="M"
onclick="submit ()"M </td>
</tr>
<tr>
<td><input type="radio" name="abbr_lett er" value="N"
onclick="submit ()"N </td>
<td><input type="radio" name="abbr_lett er" value="O"
onclick="submit ()"O </td>
<td><input type="radio" name="abbr_lett er" value="P"
onclick="submit ()"P </td>
<td><input type="radio" name="abbr_lett er" value="Q"
onclick="submit ()"Q </td>
<td><input type="radio" name="abbr_lett er" value="R"
onclick="submit ()"R </td>
<td><input type="radio" name="abbr_lett er" value="S"
onclick="submit ()"S </td>
<td><input type="radio" name="abbr_lett er" value="T"
onclick="submit ()"T </td>
<td><input type="radio" name="abbr_lett er" value="U"
onclick="submit ()"U </td>
<td><input type="radio" name="abbr_lett er" value="V"
onclick="submit ()"V </td>
<td><input type="radio" name="abbr_lett er" value="W"
onclick="submit ()"W </td>
<td><input type="radio" name="abbr_lett er" value="X"
onclick="submit ()"X </td>
<td><input type="radio" name="abbr_lett er" value="Y"
onclick="submit ()"Y </td>
<td><input type="radio" name="abbr_lett er" value="Z"
onclick="submit ()"Z </td>
</tr>
</TABLE>
</FORM>
<b><FORM NAME="author" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<SELECT NAME="author_pk " SIZE="20" COLS="10" onclick="submit ()">

<?php
//
//Check for the first time pass
if( !isset($_POST['abbr_letter']) ) {
$_POST['abbr_letter'] = $_SESSION['abbr_letter'];
}
//
//Store the latest selected option to the Session var
$_SESSION['abbr_letter'] = $_POST['abbr_letter'];
echo 'SCRIPT language=JavaSc ript
setCheckedValue ("'.$_SESSIO N['abbr_letter'].'");</SCRIPT>'; //?

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
It appears that your PHP is generating the option list part of your
page, but not the radio buttons. When you reload the page, the radio
buttons are always going to load in their default state (unchecked as
NON of them say CHECKED).

Either have your PHP script generate the radio button output (and
output CHECKED for the radio button that corresponds to the abbr_letter
value) or generate some script that onload checks the abbr_letter value
and CHECKS the corresponding radio button.

That should do it.

Nov 15 '06 #5
VK wrote:
IchBin wrote:
>The actual running code is here: http://ichbin.9999mb.com
Not sure how I can trap the the generated HTML code coming back from the
server..

The URL (as seen in browser) *is* the HTML code coming back from the
server :-) This is what I meant, thank you.

In your case the page starts from <centertag and after a bunch of
other code (inscluding script) there is finally <htmlblock wrapped
into <div>. I'm very far of being a pedantical person here, but some
*very minimum* respect to basic programming rules has to be served in
any solution IMHO. Try do not get upset: but your pages are totally
dependant on the particular UA's error correction mechanics - this way
some generic advises are futile.
I just say that if your bring you pages into a descent form the problem
very well may disappear by itself. You may just try.
Sorry I am a Java programmer. I am new to Javascript\css\ php. So you
would recommend that I rewrite this script?

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 15 '06 #6
VK

IchBin wrote:
Sorry I am a Java programmer. I am new to Javascript\css\ php. So you
would recommend that I rewrite this script?
I would recommend to make your server-side PHP to output a conventional
HTML page first. Skipping on such luxiry as doctype :-) the ouput would
be something like:

[[ Content-Type: text/html; charset=[YourCharset] ]]
<html>
<head>
<title>Your Title</head>
[[ Style data ]]
<script type="text/javascript">
[[ served generated script content ]]
</script>
</head>
<body>
[[body content ]]
<form>
[[ form content ]]
</form>
</body>
</html>

I don't give you 100% guarantee that your client-side script will start
to work as expected (only 90%) - but at least it will be possible to
make some reasonable analysis of what and why is not working.

Nov 16 '06 #7

IchBin wrote:
VK wrote:
IchBin wrote:
The actual running code is here: http://ichbin.9999mb.com
Not sure how I can trap the the generated HTML code coming back from the
server..
The URL (as seen in browser) *is* the HTML code coming back from the
server :-) This is what I meant, thank you.

In your case the page starts from <centertag and after a bunch of
other code (inscluding script) there is finally <htmlblock wrapped
into <div>. I'm very far of being a pedantical person here, but some
*very minimum* respect to basic programming rules has to be served in
any solution IMHO. Try do not get upset: but your pages are totally
dependant on the particular UA's error correction mechanics - this way
some generic advises are futile.
I just say that if your bring you pages into a descent form the problem
very well may disappear by itself. You may just try.
Sorry I am a Java programmer. I am new to Javascript\css\ php. So you
would recommend that I rewrite this script?
I too develop in Java so if it were me I'd have a nice JSP page here :)

But to answer your question I think you will find it easier if you have
your button group code also generated by your PHP script. Use the same
logic that you use to determine which subgroup to load to determine
which radio button to write CHECKED next to...

Javascript can handle it, but it's not very graceful. AFAIK the only
way to access an individual radio button within a group is through an
array. Therefore to find it programmaticall y you'd have to have your
radio buttons return values like 0, 1, 2, 3 instead of A, B, C, D and
this would force you to do some converting on the server anyway.

Just my $.02
>
--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 16 '06 #8
Tom Cole wrote:
IchBin wrote:
>VK wrote:
>>IchBin wrote:
The actual running code is here: http://ichbin.9999mb.com
Not sure how I can trap the the generated HTML code coming back from the
server..
The URL (as seen in browser) *is* the HTML code coming back from the
server :-) This is what I meant, thank you.

In your case the page starts from <centertag and after a bunch of
other code (inscluding script) there is finally <htmlblock wrapped
into <div>. I'm very far of being a pedantical person here, but some
*very minimum* respect to basic programming rules has to be served in
any solution IMHO. Try do not get upset: but your pages are totally
dependant on the particular UA's error correction mechanics - this way
some generic advises are futile.
I just say that if your bring you pages into a descent form the problem
very well may disappear by itself. You may just try.
Sorry I am a Java programmer. I am new to Javascript\css\ php. So you
would recommend that I rewrite this script?

I too develop in Java so if it were me I'd have a nice JSP page here :)

But to answer your question I think you will find it easier if you have
your button group code also generated by your PHP script. Use the same
logic that you use to determine which subgroup to load to determine
which radio button to write CHECKED next to...

Javascript can handle it, but it's not very graceful. AFAIK the only
way to access an individual radio button within a group is through an
array. Therefore to find it programmaticall y you'd have to have your
radio buttons return values like 0, 1, 2, 3 instead of A, B, C, D and
this would force you to do some converting on the server anyway.

Just my $.02
>--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
______________ _______________ _______________ _______________ ___________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Tom, your $.02 is very much appreciated.. AS to writing it in JSP. Well,
I just wanted to try something different and expand my brain. They are
different animals and wanted to get handle around html\javascript \css
and php combined. It's just a little blurry for me now. I am hearing
what all the people are saying, that is, to have php process this on the
server.

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 16 '06 #9
VK wrote:
IchBin wrote:
>Sorry I am a Java programmer. I am new to Javascript\css\ php. So you
would recommend that I rewrite this script?

I would recommend to make your server-side PHP to output a conventional
HTML page first. Skipping on such luxiry as doctype :-) the ouput would
be something like:

[[ Content-Type: text/html; charset=[YourCharset] ]]
<html>
<head>
<title>Your Title</head>
[[ Style data ]]
<script type="text/javascript">
[[ served generated script content ]]
</script>
</head>
<body>
[[body content ]]
<form>
[[ form content ]]
</form>
</body>
</html>

I don't give you 100% guarantee that your client-side script will start
to work as expected (only 90%) - but at least it will be possible to
make some reasonable analysis of what and why is not working.
Thank you for you suggestions. I will try to follow your advice.

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
_______________ _______________ _______________ _______________ __________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 16 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
8964
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9463
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6747
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6049
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4562
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2740
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2190
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.