I have a functioning messaging script. What I am trying to do is allow 2 extra things.
One is a message me button. Second is the reply feature.
When a user sends a message, they select them from the dropdown box.
So its like <option value ="id">
and it displays the username.
When using a message me button, I assume I need to post the username and select it from the list. When replying, again I post the username and it selects it from the list?
<form method='post' action='<?php echo $_SERVER['PHP_SELF']; ?>?p=new'>
<input type='hidden' name='rfrom' value='<?php echo $row['username']; ?>' />
<input type='hidden' name='rsubject' value='Re: <?php echo $row['title']; ?>' />
<input type='hidden' name='rmessage' value='Re: <<?php echo $row['message']; ?>>' />
<input type='submit' name='reply' class="button" value='Reply' />
</form>
Bu cevap kodudur. Gördüğünüz gibi, ben gibi $_POST['rfrom']
ile adı geçmesi
Ben listeden kullanıcıyı seçmek için aşağıdaki kodu ile geldi.
$fromname=(isset($_POST['rfrom'])) ? $_POST['rfrom'] : ''; //ought to validate $_POST
$selected=($u==$fromname) ? 'selected="selected"' : '';
echo "<option value='$uid'>$u</option>";
Bu işe yaramazsa ve ben Cevap tıkladığımda, ben sadece listedeki ilk kullanıcı olsun.
Also, could someone confirm if I could use the id to do this instead of the username? It would be easier when using the button to send a new message from a user's profile.
Teşekkür okuma, ben size yardımcı olur umarım!
EDIT
Ben şimdi $_POST['rfrom']
kullanılarak kullanıcı kimliği geçirerek.
Kullanıcı kimliği seçenek değeri olacaktır.
Yine de, ben listede seçilecek doğru kullanıcı alınamıyor.
Birisi yardım lütfen!