Porl123 Posted January 26, 2009 Share Posted January 26, 2009 I've got an inbox page on my site where all messages are shown in php, from mysql. Attached to each message is an invisible textarea and submit button, where you can instantly reply to a message, but because I can't use a hidden input to post the ID to the php procedure because it interferes with another <form> tag I have going around all the messages for the delete selected messages button, so I was wondering if it's possible to put <textarea name="message[<? $id; ?>]">, so the php knows which message it's replying to. Is this possible? If so, could you give me a brief example? Any help is appreciated. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/142520-post-name/ Share on other sites More sharing options...
work_it_work Posted January 26, 2009 Share Posted January 26, 2009 does this thing helps you ? <textarea name="message[<?php echo $id; ?>]"> if not, i guess you should be more explicit, and paste some code here... Quote Link to comment https://forums.phpfreaks.com/topic/142520-post-name/#findComment-746826 Share on other sites More sharing options...
Porl123 Posted January 26, 2009 Author Share Posted January 26, 2009 I haven't really got much to paste. Just wondering if that'd work Quote Link to comment https://forums.phpfreaks.com/topic/142520-post-name/#findComment-746831 Share on other sites More sharing options...
premiso Posted January 26, 2009 Share Posted January 26, 2009 I haven't really got much to paste. Just wondering if that'd work Sort of. To access the elements you would do: <?php $textAreas = $_POST['message']; foreach ($textAreas as $id => $message) { echo "ID: $id has $message for a message.<br />"; } ?> <textarea name="message[<?php echo $id; ?>]"> Also notice I changed the <? $id; ?> portion too. Quote Link to comment https://forums.phpfreaks.com/topic/142520-post-name/#findComment-746840 Share on other sites More sharing options...
Porl123 Posted January 26, 2009 Author Share Posted January 26, 2009 ah thanks premiso. life saver :] Quote Link to comment https://forums.phpfreaks.com/topic/142520-post-name/#findComment-746844 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.