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
Sarah-Kate Ryan
6,531 PointsThe submit button on my website is not working
I'm building a website for a competition. The submit button on my website is not working. Here is the code: <input type="submit" value="Send" class="relative fullwidth col-xs-12 btn"/> What am I doing wrong?
Nick Wilson
5,060 PointsThe button is only static html. You need backend PHP to make the button submit to something. You could add an event to the button when clicked that will trigger that it's working. Do you have a php script in place to submit it?
Sarah-Kate Ryan
6,531 PointsNick Wilson I have a PHP form but that's it. I'm sorry, but I'm confused on what you're asking.
Sarah-Kate Ryan
6,531 Pointsmwagner when I push the submit button, it doesn't do anything. It just stays on the same page.
3 Answers
Nick Wilson
5,060 PointsThe php form will redirect the webpage to another webpage or message when the button is clicked. You could set up a JavaScript event to test that the button is working. But the button itself doesn't do anything. It's just a button that says submit. If you haven't told the button what to do when it is clicked then the button does nothing. Check out on google a contact form in php.
Sarah-Kate Ryan
6,531 PointsI've never used JavaScript before.
Sarah-Kate Ryan
6,531 Pointswhat i'm trying to do is make an order form for a company. it doesn't want to work correctly.
Mike Wagner
23,888 PointsYour button is capable of submitting and redirecting you to another page (or even the same page, if you'd like) pretty much all on its own, with a bit of guidance from the form itself. The button itself doesn't require any changes, so I'm guessing the issue you're having is in your form element. This will require an action="example_confirmation.php" type attribute in which example_confirmation.php is a php page of you make to say something like "Your order of ___ was successful. Please check your email for details concerning shipping." or whatever you'd like it to say. It will also require a method="post" attribute in order to actually submit the information to the server for processing, which you will have to write php (or something) to handle for you. You can check out a bit of description, see an example, and even toy around with it a bit here. If you feel like you have it structured the right way, but you're still having problems, let me know and provide your form code and php handling so we can figure it out.
Mike Wagner
23,888 PointsMike Wagner
23,888 PointsThere doesn't appear to be anything wrong with that code. It's probably somewhere else related. Providing more code or possibly describing the way in which it is not working might be helpful to solving the issue