close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic Radio Group not being marked

Thread began 8/26/2011 12:19 pm by phebberd116714 | Last modified 8/29/2011 5:36 am by phebberd116714 | 1420 views | 4 replies |

phebberd116714

Dynamic Radio Group not being marked

I have a radio group that gives the user the option to show which image they want.
The list is being pulled from a separate table and the value is inserted into the main table

Using the following code changes the picture as required,

<?php do { ?>
<label>
<input type="radio" name="RadioGroup1" value="<?php echo $row_rsHomeDonateImag['imageFile']; ?>" id="RadioGroup1_<?php echo $row_rsHomeDonateImag['imageID']; ?>" />
<img src="../homeDonateImages/<?php echo $row_rsHomeDonateImag['imageFile']; ?>" alt="" width="100" height="87" /></label>
<br />
<?php } while ($row_rsHomeDonateImag = mysql_fetch_assoc($rsHomeDonateImag)); ?>

The trouble is that when updating again, the image chosen isn't marked as Checked.


When I change the radio group to be dynamic from the proerty inspector the code is changed to this:

<?php do { ?>
<label>
<input <?php if (!(strcmp($row_WADAhomeDonatePanel['leftImage'],"<?php echo $row_rsHomeDonateImag['imageFile']; ?>"))) {echo "checked=\"checked\"";} ?> type="radio" name="RadioGroup1" value="<?php echo $row_rsHomeDonateImag['imageFile']; ?>" id="RadioGroup1_<?php echo $row_rsHomeDonateImag['imageID']; ?>" />
<img src="../homeDonateImages/<?php echo $row_rsHomeDonateImag['imageFile']; ?>" alt="" width="100" height="87" /></label>
<br />
<?php } while ($row_rsHomeDonateImag = mysql_fetch_assoc($rsHomeDonateImag)); ?>

But when I test the page it is totally blank, even the source code.

Does anyone know what the problem could be.

Sign in to reply to this post

Jason ByrnesWebAssist

if it is blank, that means a php error has occurred, but error logging is turned offf.

add the following code at line 1 to turn error reporting on:

php:
<?php

error_reporting
(E_ALL);
ini_set('displa_errors','on);
?>
Sign in to reply to this post

phebberd116714

I think there were some errors in your code.
I changed to this:

<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>

and put at the top of the page at line 1 but no errors were reported

Sign in to reply to this post

phebberd116714

If I change the first part of the radio code from this:

<input <?php if (!(strcmp($row_WADAhomeDonatePanel['leftImage'],"<?php echo $row_rsHomeDonateImag['imageFile']; ?>"))) {echo "checked=\"checked\"";} ?> type="radio" name="RadioGroup1" value="<?php echo $row_rsHomeDonateImag['imageFile'];


to this:

<input <?php if (!(strcmp($row_WADAhomeDonatePanel['leftImage'],"imageFile"))) {echo "checked=\"checked\"";} ?> type="radio" name="leftImage1" value="<?php echo $row_rsHomeDonateImag['imageFile'];

The the page shows up but obviously without the item being marked.

It seems as if this is causing the problem:

"<?php echo $row_rsHomeDonateImag['imageFile']; ?>"

Sign in to reply to this post

phebberd116714

Found the solution

When making the radio group dynamic, dataassist created this code:

<input <?php if (!(strcmp($row_rsHomeDonate['donateImage_ID'],"<?php echo $row_rsDonateImages['hmeDonateImageID']; ?>"))) {echo "checked=\"checked\"";} ?> type="radio" name="donateImage_ID" value="<?php echo $row_rsDonateImages['hmeDonateImageID']; ?>" id="donateImage_ID_<?php echo $row_rsDonateImages['hmeDonateImageID']; ?>" />

It seems that instead of:
"<?php echo $row_rsDonateImages['hmeDonateImageID']; ?>"

what should have been added is:
($row_rsDonateImages['hmeDonateImageID'])

The full code below now shows the correct item marked.


<input <?php if (!(strcmp($row_rsHomeDonate['donateImage_ID'],($row_rsDonateImages['hmeDonateImageID'])))) {echo "checked=\"checked\"";} ?> type="radio" name="donateImage_ID" value="<?php echo $row_rsDonateImages['hmeDonateImageID']; ?>" id="donateImage_ID_<?php echo $row_rsDonateImages['hmeDonateImageID']; ?>" />
<?php echo $row_rsDonateImages['imageFileName']; ?></label>

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...