Jump to content

Recommended Posts

hey guys, can somebody help me with this problem?

 

sorry in advance if the problem is way too easy to figure out, I'm really new at php...

 

I try to get a dropdown list with content grabbed from a database. I then want to have it able to submit the value to another page (next_page.php), but when I try to run the website, it just shows up blank. the php error checker came up with this error:

 

PHP Syntax Check: Parse error: syntax error, unexpected '<' in your code on line 16

 

<form action="next_page.php" method="post">

my code is:

 

 

 

<!DOCTYPE html>

<html>
 
<head>
  <title>The Film Directory</title>
  <link href="site.css" rel="stylesheet">
</head>
<body>
<div>
  <h1>Film Directory</h1> 
  <h2>Choose your poison</h2>
 
  <?php
 
require "login.php";
 
<form action="next_page.php" method="post">
 
$sql="SELECT Name,FilmID FROM Films order by Name"; 
print "<select Name=Film_selection value=''>Film Name</option>";
foreach ($dbo->query($sql) as $row){
print "<option value=$row[id]>$row[Name]</option>";
}
print "</select>";
print '<input type="submit" value="Submit">';
</form>
 
$dbh = null;
?>
 
</div>
</body>
</html>
Edited by katsuowota
Link to comment
https://forums.phpfreaks.com/topic/294509-php-forms-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.