Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/142520-post-name/
Share on other sites

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.

 

Link to comment
https://forums.phpfreaks.com/topic/142520-post-name/#findComment-746840
Share on other sites

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.