I am designing a game with javascript and jquery. In my game when a player talks to another character it opens the text as an external file using the window.open('') function. At the beginning of the game the user has to enter a name for their character it is then processed by php: <form action="play.php" method="get">.
<input type="text" name="name"/><input type="submit" value="confirm"/>
</form>
As I said before when a player talks to another player it opens the external file but what I am asking is how to transfer the form data to the external window opened with window.open('') I have already tried function txtone()
{
window.open('txtone.php?name=<?php echo $_GET["name']; ?>')
}
but it didn't work. So basically what I want in the end is an external window opened with window.open('txtone.php') that can receive the php data from the page it was opened from
(rather than opening txtone.php it would open txtone.php?name=example).
Edit: I have an idea I could send a php variable to the child window opened with window.open but I have no idea how to do this mabye with window.opener?
将php表单数据传输到js窗口
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
4条回答 默认 最新
duangu8264 2013-10-20 02:08关注Did you try
window.open('txtone.php?name=<?php echo htmlspecialchars($_GET["name"]); ?>')解决 无用评论 打赏 举报