Jump to content

Trying to create a PHP quote/reply command


therocker

Recommended Posts

Hello so I'm trying to make my own simple forum. How would can I do a quick quote/ reply to comment. Something WordPress would normally do with the  #respond. I've done my own code and I can't seem to insert the code into a hidden input so that the users can't see the HTML codes that are outputted in the reply string. Generally, my code works fine and all, it's just that when someone clicks the "Quote" link, it literally inserts the actual HTML outputs into the textarea. I want something like WordPress' #respond command so that when someone hits the "Quote" link, it'll still quote the actual content the user is trying to respond to, but it'll also not output the HTML codes into the textarea.

 

Here is my PHP code:

<?php
$reply = '<div style=\"border: 1px dashed\"><span style=\"text-transform: uppercase; font-family: Oswald, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: 300; margin: 0px 10px 0px 0px; width: 100%; color: #00A6EB;\">' . $row['username'] . '</span><p>' . $row['message'] . '</p></div><br /><br />';
?>

Here is my HTML code:

<a href="#" onclick='insertext("<? echo $reply; ?>"); return false;'>Quote</a>

Here is my Javascript code:

<script type="text/javascript">
function insertext(text) {
    document.formname.messages.value += text + " ";
    document.formname.messages.focus();
}
</script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.