Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ThorZ

macrumors newbie
Original poster
Jul 23, 2007
6
0
I just designed this site...allenave.com. Give me some feedback on it.
I just started figuring out how to do a submit button. Can somebody help with a clean explanation? I dont think I get it. Is it a CGI script or do I use PHP ? I need to finish the form.

As you can see, the site needs a shopping cart.. Now that should be nice and difficult. I bought ecart, but their documentation sucks.

Thanks:)
 
Well done!

I am guessing you used a template based layout, or some device like that? No matter, the choice is very nice, good graphics and well laid out. Gets the job done nicely, so compliments galore on the design and layout aspect.

As to E-Commerce integration, if your commercial choice doesn't work out might I suggest looking into OS-Commerce which is PHP/MySQL open source, nice development community and not too terribly hard to install or modify.

http://www.oscommerce.com/

Finally, as to a "clean explanation" - could you please clarify what you mean? I looked at your contact page, noticed it already has form validation and a working submit button, but the fields simply turned green and then it reported "not active at this time". Assuming this is the area you meant, you've got the form (front end) infrastructure in place so:

Once a user clicks Submit, there is an onSubmit attribute added to the form tag that calls a JavaScript validaition function. You have this in place. Once it passes validation, all the form fields with data are processed through either a POST or GET action set in the method attribute of the form tag. This data is sent for server side processing by a script (it could be PHP, could be Perl through CGI as you noted) which processes the data and performs whatever action you need, i.e. populating a database, sending an E-Mail, or whatever. I hope this is clear enough for you, please let me know if I confused you or missed anything obvious.

Code:
<script language="javascript" type="text/javascript">
<!--//
Function ValidateMe() { 
... your validation...
}
//-->
</script><noscript>Please enable JavaScript in your browser</noscript>


<form method="post" name="myform" action="process.php" onSubmit="return ValidateMe();">
... your form here ...
<input type="submit" name="submit_page" value="Submit">
</form>

And in process.php it will use $_POST['form_variable'] for example for one of the fields set in your form, and process accordingly. If you set the form action to be the same script, you could add in this condition at the top of the page to process the form submission first:

Code:
if  (isset($_POST['submit_page'])) {
... process form...
}

Does this help?

-jim

ps: Note to gurus out there - these are simplified examples not taking into account SQL injection issues, proper accessibility requirements, XSS issues and so on. Just a basic tutorial to get this individual going strong.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.