Jump to content

Feedback form for multiple items


spacepoet

Recommended Posts

Hello:

 

I want to create a feedback form that will allow a user to select from 30 or so items on a page, and send the data to an email address. I think it's something like a shopping cart but without a need to process a payment. I want to list items (like a soccer ball, a basket ball, etc.) and allow the user to select the size of the ball, the color, the number of balls, etc. I want the user to be able to select 1 item or many items.

 

Once they are done, they would hit submit, and the data would get sent to an email address.

 

Do I need to use a session to do this?

 

I was trying to work with this code:

<?php
session_start();
session_register('product');
session_register('amount');
$_SESSION['product'] = $_POST['product'];
$_SESSION['amount'] = $_POST['amount'];

//SEND THE EMAIL CODE HERE ????

?>
<form method="post" action="">
<input type="text" size="10" name="product"><br />
<input type="text" size="10" name="amount"><br />
<input type="submit" value="Finish">
</form>

 

But I'm pretty sure I'm not in the ballpark on how to do this.

 

Anyone have any ideas?

 

Thanks in advance.

Link to comment
Share on other sites

if the form is on a single page and not requiring a login, you don't need a session...

 

just

<?php if (isset($_POST['form'])) {

#send the email
mail();

} ?>

<form>

<input type='checkbox' name='products' value='productID1'/> Product 1 <br/>
<input type='checkbox' name='products' value='productID2'/> Product 2 <br/>
<input type='submit' name='form' value='Submit' />

Link to comment
Share on other sites

Hi:

 

Ah! Yes, this makes sense - I think I was overlooking the obvious a bit.

OK, but what if I want to have the user be able to select items and attributes of items.

 

I want to add a few SELECT dropdown menus to the products as well and send them in the email.

 

Meaning if they are ordering T-Shirts - I want them to enter the amount, the color, and the size.

 

And if they want to add pants to the order, let them chose the color, size, amount, and have all the data emailed as one email when they hit submit.

 

Any ideas? This is why I thought they would need a SESSION or something like that.

 

Thanks!

Link to comment
Share on other sites

<?php if (isset($_POST['form'])) {

#send the email
$order='';
$order.=(isset($_POST['shirts']))?"shirt: {$_POST['shirts']} - size:{$_POST['shirtSize']} - colour: etc etc":'';

mail('youremail@domain.com','New Order',$order);

} ?>

<form method='POST'>

<h1>Shirts</h1>
<select name='shirts'>
<option value=''>Please Select</option>
<option value='shift2'>Shirt 2</option>
<option value='shift3'>Shirt 3</option>
</select><br/>
<h3>Size</h3>
<select name='shirtSize'>
<option value=''>Please Select</option>
<option value='small'>Small</option>
<option value='large'>Large</option>
</select>

<input type='submit' name='form' value='Submit' />

</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.