# html form question! help!



## ironsidephoto (May 17, 2007)

so here's the deal.

i'm trying to add a purchasing form to my site.
basically, a person fills out the form, the info is emailed to me, and i send them a paypal invoice. 

the question is: how do i add some sort of thing to be able to purchase more than one photo per form? maybe somehow clicking an 'add another photo' sort of button that adds another section of the form automatically? 

look at the site home>purchasing and you'll get a better idea of what i mean.


----------



## eravedesigns (May 17, 2007)

If I were you I would consider buying a script that ads a shopping cart type of thing to your site or just build your website off of a script like ecommerce. These scripts have a bunch of templates out there or you could get someone to code a design to work with it but ecommerce is one of the more popular scipts out there. Also try www.hotscripts.com for some free and good scripts maybe you can find one that will work.


----------



## ironsidephoto (May 18, 2007)

if you look at my galleries, you'd see that those ecommerce things won't go with the flow of the site. i like my flash galleries, and would like to just be able to have people buy a picture by knowing it's number in the gallery.


----------



## Alpha (May 18, 2007)

Combine this:
http://www.w3schools.com/tags/tag_select.asp

and this:
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_mail

and you should be good to go.


----------



## ironsidephoto (May 18, 2007)

so i was messing around with it and now when the form e-mails, there isn't anything in the text. will someone look at the source and tell me why?
this is tricky business.


----------



## mr e (May 18, 2007)

It probably has something to do with your form action being "http://www.hostmonster.com/monstermail", I haven't used their service (or whatever it is) so I wouldn't know specifics, but my guess is it's them.

Personally I would look into a simple PHP form email script, then you could customize i however you wanted.


----------



## ironsidephoto (May 20, 2007)

(i don't know that much about html)

the monstermail is just the e-mail service my hosting has. that forwards the info to my webmaster e-mail. 
i'm not talking about the e-mailing of the info, just how to add more lines to purchase pictures by clicking a sort of 'add another line' button. 
know what i'm talking about??

come on tpf, these are some of the weakest responses i've ever gotten!

as soon as i finish this form then my website will be COMPLETE!
muahaha.


----------



## mr e (May 22, 2007)

Well if you want to have a truly infinite amount of possible text boxes, you'll want to look into Javascript and adding elements to the DOM, then you'll want to write a function to dynamically name and append these new fields

Another less scalable way would be to put in for example 10 extra fields that all start hidden, then use JS to display them one by one when the user clicks add another field


----------



## ironsidephoto (Jun 4, 2007)

i wish i knew how to do that. any tips would be helpful.


----------



## mr e (Jun 7, 2007)

Here's something simple (by the way, TPF needs the 
	
	



```
tag so this would look normal)

Play around with this example and see what you can extrapolate from it, and if you run into problems feel free to ask, I remember first learning Javascript, and it *sucked*, it's just not a friendly language to learn

Javascript
<script type="text/javascript">
var i = 1;
function showNext()
{
     document.getElementById('text' + i).style.display = 'block';

     i++;
}
</script>

HTML
<input type="text" name="text" id="text" value="" />
<input style="display: none;" type="text" name="text1" id="text1" value="" />
<input style="display: none;" type="text" name="text2" id="text2" value="" />
<input style="display: none;" type="text" name="text3" id="text3" value="" />
<input type="button" onclick="showNext();" value="Add" />
```


----------

