I am trying to echo a submit form in my php code:
I am trying the following:
// Display results
foreach ($media->data as $data) {
echo "<a href=\"{$data->link}\"</a>";
echo "<h4>Photo by: {$data->user->username}</h6>";
echo $pictureImage = "<img src=\"{$data->images->thumbnail->url}\">";
echo "<h5>Like Count for Photo: {$data->likes->count}</h5>";
echo "<form>";
echo "<form action='tag.php' method='post'>";
echo "<input type='submit' name='submit'>";
echo "</form>";
}
Then:
if(isset($_POST['submit'])) {
echo "hello";
}
This doesn't seem to echo "hello";
Any help would be appreciated
You're missing a closing parenthesis:
if(isset($_POST['submit'])) {
^
Here
You're missing a value on the input tag. Change it to:
echo "<input type='submit' name='submit' value='Submit'>";
echo '<input type="submit" class="btn btn-primary" value="Active">';
It should be
if(isset($_POST['submit'])) {
^
echo "hello";
}
you missed a parenthesis.
Edit: Also it should be:
<input type='submit' name='submit' value='submit'>
Else $_POST['submit'] will not get set.
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.