Palastia Posted August 25, 2012 Share Posted August 25, 2012 Hi everyone Im kinda having a weird issue when attempting to echo mathml into my radiobutton value. It seems that a half of the mathml code is actually leaked outside the radiobutton itself. Something like this: [img=http://img32.imageshack.us/img32/8560/capture2jc.jpg] Is there a reason why this is happening? When I attempt to select one of the radio buttons to insert its MathML value into CKeditor, only half of the MathML code ends up being inserted into the editor. Below is the code where I retrieve the MathML and where I believe is the cause of this problem: <?php include ('database_connection.php'); $dbConn = mysql_connect('localhost', 'root', '') or trigger_error(mysql_error(), E_USER_ERROR); // select the database for use mysql_select_db('test', $dbConn); $query_retrieve_expression = "SELECT * FROM math"; $queryResource = mysql_query($query_retrieve_expression, $dbConn) or die(mysql_error()); ?> <table class="hovertable"> <tr> <th>Insert ?</th><th>Expression Name</th><th>Math Expression</th> </tr> <?php while($row = mysql_fetch_assoc($queryResource)) { ?> <tr> <td><input type="radio" name="insert" id="<?php echo $row['mathID']?>" value="<?php echo $row['mathexpression']?>" /> </td> <td><?php echo $row['expressionname']; ?></td> <td><?php echo $row['mathexpression']; ?></td> </tr> <?php } ?> </table> I would appreciate it if anyone could provide some insight on this and point me in the right direction. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/267548-echoing-mathml-as-a-value-for-radiobuttons/ Share on other sites More sharing options...
requinix Posted August 25, 2012 Share Posted August 25, 2012 There's probably a " somewhere in the markup. That'll get mixed in with the HTML and break stuff. General rule of thumb: htmlentities stuff if there's a risk of it conflicting with your HTML. value="" But why do you need it in the HTML? You're pulling it from the database anyways. Just put the ID number in the form, pass that to the next script, and have it look up the expression itself. Also means people won't be able to modify the form and insert arbitrary content. Quote Link to comment https://forums.phpfreaks.com/topic/267548-echoing-mathml-as-a-value-for-radiobuttons/#findComment-1372271 Share on other sites More sharing options...
Palastia Posted August 25, 2012 Author Share Posted August 25, 2012 Ah I see! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/267548-echoing-mathml-as-a-value-for-radiobuttons/#findComment-1372272 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.