evandrosx

Membros
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutro

About evandrosx

  1. lowys, segue abaixo o formulario em html. <form method="post" id="onlineorder" action="sendform.php"> <fieldset id="user"> <legend> IDENTIFICATION </legend> <p><label for="name">Name:<span style="color:red">*</span></label> <input type="text" name="name" id= "name" size="32" maxlength="40" placeholder="Enter your name" required/></p> <p><label for="business">Business:<span style="color:red">*</span></label> <input type="text" name="business" id= "business" size="30" maxlength="60" placeholder="Enter your business name" required/></p> <p><label for="email">Email:<span style="color:red">*</span></label> <input type="email" name="email" id= "email" size="32" maxlength="60" placeholder="Enter your email" required/></p> <p><label for="phone">Phone:</label> <input type="text" name="phone" id= "phone" size="32" maxlength="40" placeholder="Enter your phone number" /></p> </fieldset> <p></p> <fieldset id="listproducts"> <legend> PRODUCTS </legend> <div id = 'forclone'> <select name="product" id="product"> <optgroup label="GALLON BAG"> <option>GALLON BAG BANANA SPLIT</option> <option>GALLON BAG BIRTHDAY CAKE</option> <option>GALLON BAG COTTON CANDY</option> <option>GALLON BAG CHOC. COOKIE DOUGH</option> <option>GALLON BAG CHOCOLATE</option> <option>GALLON BAG COOKIE N` CREAM</option> <option>GALLON BAG MINT CHOCOLATE</option> <option>GALLON BAG STRAWBERRY</option> <option>GALLON BAG VANILLA</option> <option>GALLON BAG RAINBOW ICE</option> <option>GALLON BAG IC - LIBERTY</option> <option>GALLON BAG STRAWBERRY CCY</option> <option>GALLON BAG CANDY BAR CRUNCH</option> <option>GALLON BAG CRML BROWNIE SUNDAE</option> <option>GALLON BAG BUBBLE GUM</option> <option>GALLON BAG MOOSE TRACKS</option> <option>GALLON BAG ROCKIN CHERRY ICE</option> <option>GALLON BAG GOLD COOKIES & CREAM</option> <option>GALLON BAG REDBERRY SHERBET</option> </optgroup> <optgroup label="PRE-CUP"> <option>PRE-CUP BANANA SPLIT</option> <option>PRE-CUP CHOCOLATE</option> <option>PRE-CUP COTTON CANDY</option> <option>PRE-CUP CHOC CHIP COOKIE DOUGH</option> <option>PRE-CUP COOKIES N CREAM</option> <option>PRE-CUP RAINBOW ICE</option> </optgroup> <optgroup label="PRE-PACK"> <option>PREPACK MINT CHOCOLATE</option> <option>PREPACK REDBERRY SHERBET</option> <option>YODOTS BLUE COTTON CANDY</option> <option>YODOTS CHOCOLATE COOKIE DOUGH</option> <option>YODOTS COOKIES 'N CREAM</option> <option>YODOTS CHOCOLATE VANILLA</option> <option>PREPACK BIRTHDAY CAKE</option> <option>PREPACK BANANA SPLIT</option> <option>PREPACK COTTON CANDY</option> <option>PREPACK CHOC CHIP COOKIES DOUGH</option> <option>PREPACK CHOCOLATE</option> <option>PREPACK COOKIES N CREAM</option> <option>PREPACK RAINBOW ICE</option> <option>PREPACK STRAWBERRY</option> <option>PREPACK VANILLA</option> </optgroup> <optgroup label="CUPS"> <option>3.05oz LOGO CUPS (1000/CASE)</option> <option>5oz LOGO CUPS (1000/CASE)</option> <option>9oz PARFAIT CUPS (1000/CASE)</option> <option>12oz PARFAIT CUPS (2500/CASE)</option> <option>1/2oz SAMPLES CUPS (2500/CASE)</option> </optgroup> </select> <label for="quantity">Quantity:<span style="color:red">*</span></label> <input type="number" name="quantity" id="quantity" placeholder="Qnt" min="0" max="9999" required/> </div> <div id="dynamicinput"></div> <input type="button" value="New Product" onclick="addInput('dynamicinput');" /> </fieldset> <p></p> <p></p> <p></p> <input type="submit" value="SUBMIT"> </form>
  2. Boa Noite, Estou criando um formulário de pedido. Nesse formulário tem um campo com o produto e a quantidade. Eu estou utilizando uma função javascript para clonar o campo quando o cliente quer mais um produto, com isso cada vez que o cliente clica em novo produto cria uma nova caixa de seleção para ele selecionar o produto desejado e depois preenche a quantidade. O que eu preciso é enviar esses dados que são gerados atraves dessa função por php. Tentei varias coisas mas em nenhuma obtive sucesso. Segue abaixo os codigos. Javascript var runningproducttally = 1; function addInput(divName) { var copy = document.getElementById('forclone').cloneNode(true); var select1 = copy.getElementsByTagName('select')[0]; select1.setAttribute("name","product"+runningproducttally); document.getElementById(divName).appendChild(copy); runningproducttally++; } PHP <?php if(isset($_POST['email'])) { $email_to = "[email protected]"; $email_subject = "[ Online Order ]"; function died($error) { echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } if(!isset($_POST['name']) || !isset($_POST['business']) || !isset($_POST['email']) || !isset($_POST['phone']) || !isset($_POST['quantity']) || !isset($_POST['product'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $name = $_POST['name']; // required $business = $_POST['business']; // required $email_from = $_POST['email']; // required $phone = $_POST['phone']; // not required $quantity = $_POST['quantity']; // required $product = $_POST['product']; // not required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "<strong>You received an online order. <br>Follow below the informations.</strong><br><br>\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "<br><strong>Name: </strong>".clean_string($name)."\n"; $email_message .= "<br><strong>Business: </strong>".clean_string($business)."\n"; $email_message .= "<br><strong>Email: </strong>".clean_string($email_from)."\n"; $email_message .= "<br><strong>Phone: </strong>".clean_string($phone)."\n"; $email_message .= "<br><br><strong>ORDER: </strong>\n"; $email_message .= "<br><br><strong>Qty: </strong>".clean_string($quantity)."\n"; $email_message .= "&nbsp;&nbsp;<strong>Product: </strong>".clean_string($product)."\n"; $headers = "Content-Type: text/html; charset= UTF-8 \r\n"; $headers .= 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <p>Thank you for order. We will contact you as soon as possible.</p> <p>You can close this page now.</p> <?php } ?> HTML <fieldset id="listproducts"> <legend> PRODUCTS </legend> <div id = 'forclone'> <select name="product" id="product"> <optgroup label="GALLON BAG"> <option>GALLON BAG BANANA SPLIT</option> <option>GALLON BAG BIRTHDAY CAKE</option> <option>GALLON BAG COTTON CANDY</option> </optgroup> <optgroup label="PRE-CUP"> <option>PRE-CUP BANANA SPLIT</option> <option>PRE-CUP CHOCOLATE</option> <option>PRE-CUP COTTON CANDY</option> </optgroup> </select> <select name="quantity" id="quantity"> <optgroup label="Qty"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </optgroup> </select>