user7939273
user7939273

Reputation:

Creating/echoing POST form within PHP code

I'm trying to create a form post within a larger block of PHP code, but overall my web page fails to load. To troubleshoot this, I've commented out a specific section of code and I think I've found where my error code be, even if I don't know what that error is -- when this code is commented, my page works, albeit without the added content below.

          echo '<form method="POST" action="addPeople.php">
                First Name: <input type="text" name="FirstName"><br>
                Last Name: <input type="text" name="LastName"><br>
                Birthdate: <input type="text" name="Birthdate"><br>
                Birth City: <input type="text" name="BirthCity"><br>
                Birth State: <input type="text" name="BirthState"><br>
                Region: <input type="text" name="Region"><br>
                <input type="submit" name = "submit" class="button tiny round" value="Add Person" />
                </form>'

Have I overlooked a syntax error with my quotations? Or maybe I'm just not handling the form method correctly? Would really appreciate some insight.

Upvotes: 0

Views: 33

Answers (1)

S&#233;bastien S.
S&#233;bastien S.

Reputation: 1544

You forgot the ;.

Try :

echo '<form method="POST" action="addPeople.php">
                First Name: <input type="text" name="FirstName"><br>
                Last Name: <input type="text" name="LastName"><br>
                Birthdate: <input type="text" name="Birthdate"><br>
                Birth City: <input type="text" name="BirthCity"><br>
                Birth State: <input type="text" name="BirthState"><br>
                Region: <input type="text" name="Region"><br>
                <input type="submit" name = "submit" class="button tiny round" value="Add Person" />
                </form>';

Upvotes: 2

Related Questions