I am trying to write a script in PHP that can send a message to some user on a forum. So for example, the message form can be formatted like such:
<input>Username Goes Here</input
<textarea>Message Goes Here</textarea>
Luckily I am able to populate the input field from how the URL is formatted. However, I am not so lucky with the textarea part.
How would I be able to populate the textarea field?
The link is formatted as such:
https://live.xbox.com/en-US/Messages?gamertag=gamertag
Where "gamertag" is the recipient
The textarea is formatted as:
<textarea class="compose empty" empty="true">Say something here...</textarea>
Thanks for the help!
Like this :
<textarea class="compose empty" empty="true"><?php echo htmlspecialchars($_REQUEST['gamertag']);?></textarea>
Considering the url is
https://live.xbox.com/en-US/Messages?gamertag=gamertag
You can get the value of gamertag like :
$gamertag = htmlspecialchars($_GET['gamertag']);
$gamertag = htmlspecialchars($_REQUEST['gamertag']);
To include static content :
<textarea class="compose empty" empty="true">Your Verification Code is : <?php echo htmlspecialchars($_REQUEST['gamertag']);?></textarea>
Your website can't cause a user's browser to pre-populate arbitrary fields on a third party site.
Presumably Microsoft provide a mechanism to pre-populate the username field for the purposes of "Contact me" links, but not the message since the positive use cases for that are far fewer and it encourages spammy messages.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.