Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Integrating with PayPal HTML Forms

The code below contains a simple HTML form. It looks fine in the browser, but it does not send the information to the se

Please help im stuck

form.html
<!DOCTYPE html>
<html>
<head>
    <title>Ye Olde Ice Cream Shoppe</title>
</head>
<body>

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

    <form>

        <label for="flavor">Flavor</label>
        <select id="flavor">
            <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>
        </select>

        <input type="submit" value="Update Order">

    </form>

</body>
</html>

2 Answers

MUZ140610 Tinashe Marunda

You need to put more into your FORM tag. You need to tell the browser where you want the information to be sent. Add an action parameter to the form and put the script you want the information to be sent to.

<form action="script.php">

Where script.php is the script you want the information sent to. You should also put a method in as well. You put POST if you want to send a lot of information as well as protected information. You put GET if you want to send information through the URL and if you are sending a few unprotected pieces of information. By default, POST is used and really should be used. Just make sure that you use the $_POST array variable in order to access your information in the script handling your user input. Hope this helps.

<form action="script.php" method="POST">

Cheers!

Tinashe,

Remember to use the action attribute in a form element to send data to another page. You set this attribute equal to the page you want to send data to. You should also set the method attribute to the way you wish to send the data i.e. POST or GET.

You need to also pay attention to your other questions that you posted. If the answers helped you, you should at the very least comment back.