问题
I am posting a string through an HTML form with the following code:
<html>
<body>
<form name="form" enctype="multipart/form-data" action="test.php" method="post">
<input name="message"
type="text" value=""><br/><br/>
<input type="submit" value="Upload"/><br/>
</form>
</body>
</html>
The code for test.php is the following:
<?php
$string1 = '$_POST["message"]';
$og_url = "http://thepropagator.com/facebook/testapp/issue.php?name=".$string1;
echo $og_url;
?>
The problem I'm having is that the posted string "$string1" does not seem to be showing at the end of the URL "http://thepropagator.com/facebook/testapp/issue.php?name=" that I am trying to concatenate it with. Can anyone please explain what I'm doing wrong?
回答1:
I think you want $string1 = $_POST['message'];
, no quotes. Though I'd expect your code to come up with http://thepropagator.com/facebook/testapp/issue.php?name=$_POST["message"]
url.
来源:https://stackoverflow.com/questions/8874019/concatenating-strings-retrieved-from-form-post-in-php