Jump to content

Recommended Posts

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.

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.