Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Simple PHP Application Integrating with PayPal HTML Forms

I make the method = post and i create a submit button; what special attribute should i put in the select tag?

i dont find anything which can access post data from server please help

<!DOCTYPE html>
    <title>Ye Olde Ice Cream Shoppe</title>

    <p>Your order has been created. What flavor of ice cream would you like to add to it?</p>

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

        <label for="flavor">Flavor</label>
        <select id="flavor" <?php $a= $_POST; ?> >
            <option value="">&#8212; Select &#8212;</option>
            <option value="Vanilla">Vanilla</option>
            <option value="Chocolate">Chocolate</option>
            <option value="Strawberry">Strawberry</option>
            <option value="Cookie Dough">Cookie Dough</option>
          <?php $_POST=value ?>
        <input type="submit" value="Submit">



1 Answer

This line:

<?php $_POST=value ?>

will give you a syntax error - plus probably best not to overwrite the super global $_POST variable! I would remove this line.

remove the php from the select element:

<select id="flavor" <?php $a= $_POST; ?> >

You'll need to give the select element an attribute of name to pass it through the form submission and access it via $_POST['flavor']

   <select id="flavor" name="flavor">