I have a form that I want to edit the values from the database. I am able to update all my values except for the radio boxes populated from my database. After my UPDATE command, the value being grabbed is the initial checked value from the database.

<?php $db_maritalstatus = $row_rsAdvancedPlan['maritalstatus']; ?>
<input name="maritalstatus" id="maritalstatus" value="single" <?php echo ($db_maritalstatus == "single") ? ' checked="checked"' : '' ?> type="radio" /> <label for="single" class="smaller">Single</label>

Then I use this code to grab new value, but it grabs the checked value initially loaded from database

$maritalstatus = mysql_real_escape_string($_POST['maritalstatus']);

Recommended Answers

All 3 Replies

Simple thing, but it looks like you didn't terminate your ternary operator with a semicolon.

Voila!! Thank you so much! My code now works!

No problem. Those darned semicolons (or lack thereof) can be quite a bugger sometimes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.