jm33990 Posted April 12, 2010 Share Posted April 12, 2010 I've stared at this way to long an would be happy (and probably embarrassed) if you can show me the flaw. Maybe there is no error and I'm doing something illegal....?? I'm using a radio button to group two items together. These items show perfectly on the web page but are not returned properly to the posting program. The first item is shown on the web page and posted back to the same program for processing. The second item is shown on the web page but NOT posted back to the same program for processing. They both share the same radio button name. foreach ($result as $line) { list($d1,,,$type,$d2) = split(' +',$line); if ($type == "CNAME") { list($alias,$discard) = split('[.]',$d1); echo "<br>"; echo "<input type=radio name=\"del\" value=\"#$alias\">$alias"; } echo "</table>"; } echo "<br><br>Comments..<br>"; foreach ($result as $line) { list($d1,,,$type,$d3) = split(' +',$line); if ($type == "TXT") { echo "<input type=radio name=\"del\" value=\"$d3\">$d3"; echo "<br>"; } } After submit the same program pulls the posted info... $itemdelete = $_POST['del']; echo "startup itemdelete is $itemdelete ...<br>"; If it's $alias passed it's posted OK...if $d3 passed it's empty....why Thank You. Quote Link to comment https://forums.phpfreaks.com/topic/198270-can-you-see-the-coding-flaw-i-cant/ Share on other sites More sharing options...
taquitosensei Posted April 12, 2010 Share Posted April 12, 2010 with a radio you can only select one out of the group that has the same name and the one that is selected gets returned. Quote Link to comment https://forums.phpfreaks.com/topic/198270-can-you-see-the-coding-flaw-i-cant/#findComment-1040357 Share on other sites More sharing options...
jm33990 Posted April 12, 2010 Author Share Posted April 12, 2010 I realize that only the selected one is returned The problem is if the TXT item is selected the $d3 value does not get returned. If a CNAME item is selected the #$alias value is returned. I know in both cases it is set properly because I can see them on the web page beside the buttons thanks anyway for the help Quote Link to comment https://forums.phpfreaks.com/topic/198270-can-you-see-the-coding-flaw-i-cant/#findComment-1040388 Share on other sites More sharing options...
jm33990 Posted April 12, 2010 Author Share Posted April 12, 2010 I changed value=\"$d3\" to value=$d3 why that matters yet value=\"#$alias\" is acceptable is a mystery to me...anyone care to explain. summary value=\"$d3\ --- does not work value=$d3 --- works value=\"#$alias\" --- works value=#$alias ---- works wierd..must be something to do with # Quote Link to comment https://forums.phpfreaks.com/topic/198270-can-you-see-the-coding-flaw-i-cant/#findComment-1040470 Share on other sites More sharing options...
Ken2k7 Posted April 12, 2010 Share Posted April 12, 2010 One reason why variable interpolation is confusing. It's hard to tell if you meant the variable $d or $d3. Of course, $d may be undefined, but so what? No one knows what you mean. Try putting braces around the variable if you interpolate them, such as {$d3}. But it's best to just not interpolate them. I suggest string concatenation or string formatting with sprintf or printf. Quote Link to comment https://forums.phpfreaks.com/topic/198270-can-you-see-the-coding-flaw-i-cant/#findComment-1040475 Share on other sites More sharing options...
jm33990 Posted April 12, 2010 Author Share Posted April 12, 2010 you lost me.... I thought my original post (and post #3) made it clear we were talking about $d3. I still don't know why \"$d3\" fails and \"#$alias\" does not for value= on a radio button?? anyway it's working now that I removed the \" that was wrapped around the value= parameter's Quote Link to comment https://forums.phpfreaks.com/topic/198270-can-you-see-the-coding-flaw-i-cant/#findComment-1040492 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.