| | |
PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2009
Posts: 58
Reputation:
Solved Threads: 0
Hii
I want to design a contact form with multiple fields
like title, firstname, lastname,country,email,address,pincode on one page at the bottom with next button and on other page want to add some more fields with checkbox and radio buttons ....
please tell me how to design it and its coding in PHP?
I want to design a contact form with multiple fields
like title, firstname, lastname,country,email,address,pincode on one page at the bottom with next button and on other page want to add some more fields with checkbox and radio buttons ....
please tell me how to design it and its coding in PHP?
•
•
Join Date: Jan 2009
Posts: 61
Reputation:
Solved Threads: 4
Why not just do it all on one page? Anyways, contact forms are quite simple. (As in, if you put some effort into a Google search, you'd find hundreds of thousands of tutorials.)
We're not here to code for you, we're here to help you when you're stumped. Have you tried starting? Google "php contact form", and come back once you've attempted to code something.
We're not here to code for you, we're here to help you when you're stumped. Have you tried starting? Google "php contact form", and come back once you've attempted to code something.
The following is a sample of a very basic email form which you can try editing:
php Syntax (Toggle Plain Text)
<? if (isset($_POST['subject']) && $_POST['message']!=='') { $address = "your_real_email@domain.com"; //change this to the receiving address. $subject = "Website Email: ".$_POST['subject']; if ($_POST['name']!=='') { $body = "<table border=0 cellpadding=5 cellspacing=0 width=200><tr><td>".$_POST['message']."<br> <br> Yours Sincerely<br> ".$_POST['name']."</td></tr></table>"; } else { $body = "<table border=0 cellpadding=5 cellspacing=0 width=200><tr><td>".$_POST['message']. "</td></tr></table>"; } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: do_not_reply@your_website_form' . "\r\n"; mail($address,$subject,$body,$headers); } //below displays the form while above processes it. echo "<form method='post'>Subject: <input type=text value='' maxlength=100 name='subject' size=30><br> <textarea cols=30 rows=20 name='message'></textarea><br>Name: <input type='text' value='' name='name'> <input type='submit' value='submit'></form>"; ?>
Last edited by cwarn23; Feb 27th, 2009 at 10:22 pm.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
•
•
Join Date: Feb 2009
Posts: 58
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
<?php $body = ""; foreach($_POST as $key => $value) { $body .= "$key : $value \n"; } mail("your-email", "Web site comments", $body, "From: [email]webmaster@yahoo.co.uk[/email]"); ?>
my contact form consist 5 pages but the above code showing output only 5th page , can anyone tell me why it is nt showing other pages output...
Last edited by peter_budo; Mar 1st, 2009 at 6:42 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Feb 2009
Posts: 58
Reputation:
Solved Threads: 0
PHP Syntax (Toggle Plain Text)
<script language="javascript"> function funAgree(){ document.form1.action=""; } function funDisagree(){ document.form1.action="2.php"; } </script><img src="images/detail.jpg" alt="" /></td> <td width="435"><form id="form1" name="form1" method="post" action="mail.php"> <span class="large">Title(eg.Mr,Mrs,Dr)<br /> </span> <input name="title" type="text" id="textfield" /> <br> </label> <br> <span class="large">First name *<br /> </span> <input name="name" type="text" id="textfield2" /> <span class="small"> </label> (required)</span><br> <br> <span class="large">Last name<br /> </span> <input name="lname" type="text" id="textfield3" /> <br> <span class="large"> <br> Address</span><br /> <label> <textarea name="address" id="textarea" ></textarea> </label> <span class="large"> </label> <br> <br> <span class="large">PIN / Post Code</span><br /> <input name="pin" type="text" id="textfield" /> <br> <br> <span class="large">Country</span><br /> <input name="country" type="text" id="textfield" /> <br> <br> <span class="large"></span> <span class="large"></span> Contact No * <label> </label> </span> <label> <br /> <input name="contact" type="text" id="textfield5" /> </label> <span class="small">(required)</span><span class="large"><br> <br> Email Address *<br /> <label> </label> </span> <label> <input name="email" type="text" id="textfield" > </label> <span class="small">(required)</span><br> <div align="right"><br> <br> <label> <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" > </label> </label> </div> </form> this is the first contact page <script language="javascript"> function funAgree(){ document.form1.action="requirements-form.php"; } function funDisagree(){ document.form1.action="3.php"; } </script> <form id="form1" name="form1" method="post" action="mail.php"> <span class="large">Business name</span> <input name="business" type="text" id="textfield" /> <br> <span class="large"></span> </label> <span class="large"> <br> What is the nature of your business ?</span> <label> <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> <br> </label> <br> <span class="large">What age group are your products aimed towards? (e.g. 25-35yrs)</span> <input name="product" type="text" id="textfield" /> <br> <span class="large"></span> </label> <br> <span class="large">Number of staff within your organisation </span> <input name="staff" type="text" id="textfield" /> <br> <br> <span class="large">What are your objectives for a new website? </span> <br> <br> <label> <input type="checkbox" name="checkbox" value="a"> <span class="large">provide information about the business </span><br> <label> <input type="checkbox" name="checkbox2" value="b"> </label> <span class="large">online selling </span><br> <label> <input type="checkbox" name="checkbox3" value="c"> </label> <span class="large">e-marketing for customers </span><br> <label> <input type="checkbox" name="checkbox4" value="d"> </label> <span class="large">training for staff </span><br> <label> <input type="checkbox" name="checkbox5" value="e" checked="checked"> </label> <span class="large">Other, please specify <br> <input name="other" type="text" id="textfield" /> <br> </span> <span class="large"><br> <br> <label> </label> </span> <label> <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()"> </label> </label> <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" > </form> this is second page.. <script language="javascript"> function funAgree(){ document.form1.action="2.php"; } function funDisagree(){ document.form1.action="4.php"; } </script> <form id="form1" name="form1" method="post" action="mail.php"> <span class="large">Do you currently have a website?<br> <br> <input type="radio" name="radio" value="1">yes - If 'yes', please specify website address<br> <input name="website" type="text" id="textfield" /> <br> <span class="large"></span> </label> <span class="large"> <label> <input type="radio" name="radio" value="1"> no - If 'no', what web address would you like?<br> <span class="eg"><em>e.g www.limoservices.co.uk</em> </span><span class="large"><BR> <input name="no" type="text" id="textfield" /> <br> <br> How webpages are required?<br> <label><input type="radio" name="color" value="1" checked>1<br> <input type="radio" name="color" value="1">1-5<br> <input type="radio" name="color" value="1">5-25<br> <input type="radio" name="color" value="1"> large database site with 100's of pages<br> <input type="radio" name="color" value="1"> not sure <br> <br> What webpages do you want on your website? <BR> (e.g. galleries, about us, product, services , enquiry form, documents downloads, video etc.) <br> <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> <br> <label><br> </label> <span class="large">Do you require web hosting?</span><br> <input type="radio" name="hosting" value="1" checked>yes<br> <input type="radio" name="hosting" value="1">no<br> <input type="radio" name="hosting" value="1">not sure<br> <br> <span class="large">Do you require an email account?</span><span class="eg"><br> <em> e.g <a href="mailto:info@limoservices.co.uk">info@limoservices.co.uk</a></em></span> <input name="account" type="text" id="textfield" /> <br> <br> <span class="large">Please provide web address links to websites that you would like your website to be similar </span><br> <br> <span class="large">Web address 1</span><br> <input name="web1" type="text" id="textfield" /> <br> <br> <span class="large">Explain why you like it </span><br> <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea><br> </span><br> <hr> <br> <span class="large">Web address 2</span><br> <input name="web2" type="text" id="textfield" /> <br> <br> <span class="large">Explain why you like it </span><br> <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea><br><br> <span class="large">Do you have a logo or brand identity that you would like us to use?</span> <br> <label> <input type="radio" name="brand" value="1" checked>yes<br> <input type="radio" name="brand" value="1">no<br> <br> <span class="large">Do you have your own digital images that you would like us to use?<br> <label> <input type="radio" name="images" value="1" checked>yes<br> <input type="radio" name="images" value="1">no<br> <input type="radio" name="images" value="1" checked>i would like help with images<br> <br> <span class="large">Do you have the text that is to be used on the website?</span><br> <label> <input type="radio" name="text" value="1" checked>yes<br> <input type="radio" name="text" value="1">no<br> <input type="radio" name="text" value="1">I would like help with the text<br> <br> <span class="large">Does your website need to be in any multi-ethnic languages such as Punjabi, Bangladeshi, Urdu, polish, French etc?</span><br> <label> <input type="radio" name="lang" value="1" checked>no<br> <input type="radio" name="lang" value="1">If 'yes', please specify<br> <input name="yes" type="text" id="textfield" /> <br> <br> <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()"> </label> </label> <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" > </form> this is 3rd page <script language="javascript"> function funAgree(){ document.form1.action="3.php"; } function funDisagree(){ document.form1.action="5.php"; } </script> <form id="form1" name="form1" method="post" action="mail.php"> <span class="large">Please select which website features you would like?<br> </span><span class="large"> <label> <input type="checkbox" name="checkbox" id="checkbox"> </label> Live video cameras <br> <label> <input type="checkbox" name="checkbox2" id="checkbox2"> </label> Contact form <br> <label> <input type="checkbox" name="checkbox3" id="checkbox3"> </label> Video clips <BR> <label> <input type="checkbox" name="checkbox4" id="checkbox4"> </label> Guestbook<br> <label> <input type="checkbox" name="checkbox5" id="checkbox5"> </label> News alerts <br> <label> <input type="checkbox" name="checkbox6" id="checkbox6"> </label> Dynamic picture galleries <br> <label> <input type="checkbox" name="checkbox7" id="checkbox7"> </label> Blog<br> <label> <input type="checkbox" name="checkbox8" id="checkbox8"> </label> Website feedback form <br> <label> <input type="checkbox" name="checkbox9" id="checkbox9" checked="checked"> </label> Virtual tours <br> <br> Enter additional website features you require <br> <label></label><textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> <br> <br><hr> <div align="center" class="large"></div> <br> Please select which Graphic and designs features you would like<br> <label> <input type="checkbox" name="checkbox10" id="checkbox10"> </label> Brochures<br> <label> <input type="checkbox" name="checkbox11" id="checkbox11"> </label> Business cards<br> <label> <input type="checkbox" name="checkbox12" id="checkbox12"> </label> Flyers<br> <label> <input type="checkbox" name="checkbox13" id="checkbox13"> </label> Pamphlet<br> <label> <input type="checkbox" name="checkbox14" id="checkbox14"> </label> Catalogue<br> <label> <input type="checkbox" name="checkbox15" id="checkbox15"> </label> Letterheads <br> <label> <input type="checkbox" name="checkbox16" id="checkbox16"> </label> Logo designs <br> <label> <input type="checkbox" name="checkbox17" id="checkbox17"> </label> posters<br> <label> <input type="checkbox" name="checkbox18" id="checkbox18"> </label> Compliment slip <br> <label> <input type="checkbox" name="checkbox19" id="checkbox19"> </label> Annual reports <br> <label> <input type="checkbox" name="checkbox20" id="checkbox20"> </label> Newsletters<br> <label> <input type="checkbox" name="checkbox21" id="checkbox21" checked="checked"> </label> Calendar<br> <br> Enter additional graphics and design requirements you require <br> <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> <br> </span> <label><br> </label> <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()"> </label> </label> <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" > </form> this is 4th page <script language="javascript"> function funAgree(){ document.form1.action="4.php"; } function funDisagree(){ document.form1.action="mail.php"; } </script> <form id="form1" name="form1" method="post" action="mail.php"> <span class="large">How do you want your website updated?<br> <input type="radio" name="website" value="1" checked> I would like help with updating my website <br> <input type="radio" name="website" value="1"> I will update the website my self<br> <input type="radio" name="website" value="1"> I would like training on how to update the website<br> <input type="radio" name="website" value="1" > not sure<br> </span><span class="large"> <label></label> <br> How would you rate your computer literacy skills<br> <label> <input type="radio" name="skill" value="1" > poor<br> <input type="radio" name="skill" value="1"> medium<br> <input type="radio" name="skill" value="1"> good<br> <input type="radio" name="skill" value="1" checked> excellent<br> <br> How often does your website need to be updated ?<br> <label> <input type="radio" name="update" value="1" checked> not very often<br> <input type="radio" name="update" value="1"> occasionally<br> <input type="radio" name="update" value="1"> frequently<br> <input type="radio" name="update" value="1"> not sure<br> <br> What sections of your website do you need to update the most<br> <label></label><textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> <br> <br><hr> When do you wish to launch the website ?<br> <label></label> <label> <input type="launch" name="launch" id="textfield"> <br> </label> <br> Please enter reference code 10% for discount <br> <input type="text" name="code" id="textfield"> <br> <br> Please enter any other information that you feel is relevant to the project here<br> <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> <br> <br> Enter verification image <br><input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"/> <img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br /> <br /> <!-- if the variable "wrong_code" is sent from previous page then display the error field --> <?php if(isset($_GET['wrong_code'])){?> <div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div><br /> <?php ;}?> </span> <label><br> </label> <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()"> </label> </label> <input name="button" type="submit" class="submitCopy" id="button2" value="Submit" onClick="funDisagree()" > </form> this is 5th page <?php $body = ""; foreach($_POST as $key => $value) { $body .= "$key : $value \n"; } mail("your-email", "Web site comments", $body, "From: <a href="mailto:webmaster@yahoo.co.uk">webmaster@yahoo.co.uk</a>"); ?>
this is php page...
can anyone tell me how it will show all page output..
Last edited by peter_budo; Mar 1st, 2009 at 6:43 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
It is because you are using multiple html forms and you can only submit the form which javascript specifies or the form the the submit button is inside. So you will need to either merge all the forms to one big form or submit the forms one at a time.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
Then when one file posts to another, include the following code and will convert the $_POST to $_SESSION. But be sure to put
So when you submit the last page, you can then refer to all the previous posts as sessions.
session_start(); at the top of your pages. php Syntax (Toggle Plain Text)
foreach($_POST AS $keyzz => $valzz) { $_SESSION[$keyzz]=$valzz; }
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - Oopy Doopy Do 2U2!
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - Oopy Doopy Do 2U2!
•
•
Join Date: Feb 2009
Posts: 19
Reputation:
Solved Threads: 0
•
•
•
•
cwarn23 i did update u told me but nothing it only showing 5th page form output not others...
Hi rohnni...
if u take 5 forms..
than i can do like this way...after completion of first page, u can insert data into your table...if first submit form succefully submitted, than form action give to second page...
from second page onwards u need to update ur table untill u completed 5 pages...
after completion of all pages.at the last page u retrive complete data from ur table and send them to their mailid...
in this way u have to take ur own risk...
![]() |
Similar Threads
- PHP / My SQL Web developer (Web Development Job Offers)
- Project available for PHP Developer (Web Development Job Offers)
- PHP/MySQL Programmer Position (Web Development Job Offers)
- Are you a PHP and Javascript junkie? It's time you met Emma. (Software Development Job Offers)
- PHP MYSQL Developer Position Available (Web Development Job Offers)
- PHP Web Programmer (Post your Resume)
Other Threads in the PHP Forum
- Previous Thread: Contact form
- Next Thread: Pizza ordering system
Views: 1629 | Replies: 53
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql oop parse password paypal pdf php problem query radio random recursion regex remote script search select seo server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web webdesign xml youtube






