PHP

Reply

Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

PHP

 
0
  #1
Feb 27th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 61
Reputation: Andrieux is an unknown quantity at this point 
Solved Threads: 4
Andrieux Andrieux is online now Online
Junior Poster in Training

Re: PHP

 
0
  #2
Feb 27th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,540
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 137
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso

Re: PHP

 
0
  #3
Feb 27th, 2009
The following is a sample of a very basic email form which you can try editing:
  1. <?
  2. if (isset($_POST['subject']) && $_POST['message']!=='')
  3. {
  4. $address = "your_real_email@domain.com"; //change this to the receiving address.
  5. $subject = "Website Email: ".$_POST['subject'];
  6. if ($_POST['name']!=='')
  7. {
  8. $body = "<table border=0 cellpadding=5 cellspacing=0 width=200><tr><td>".$_POST['message']."<br>
  9. <br>
  10. Yours Sincerely<br>
  11. ".$_POST['name']."</td></tr></table>";
  12. } else {
  13. $body = "<table border=0 cellpadding=5 cellspacing=0 width=200><tr><td>".$_POST['message'].
  14. "</td></tr></table>";
  15. }
  16. $headers = 'MIME-Version: 1.0' . "\r\n";
  17. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  18. $headers .= 'From: do_not_reply@your_website_form' . "\r\n";
  19.  
  20. mail($address,$subject,$body,$headers);
  21. }
  22. //below displays the form while above processes it.
  23. echo "<form method='post'>Subject: <input type=text value='' maxlength=100 name='subject' size=30><br>
  24. <textarea cols=30 rows=20 name='message'></textarea><br>Name: <input type='text' value='' name='name'>
  25. <input type='submit' value='submit'></form>";
  26. ?>
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/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - Oopy Doopy Do 2U2!
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: PHP

 
0
  #4
Feb 28th, 2009
  1. <?php
  2. $body = "";
  3. foreach($_POST as $key => $value) {
  4. $body .= "$key : $value \n";
  5. }
  6. mail("your-email", "Web site comments", $body, "From: [email]webmaster@yahoo.co.uk[/email]");
  7. ?>
Thanks - Email Send - Done

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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: PHP

 
0
  #5
Feb 28th, 2009
  1. <script language="javascript">
  2. function funAgree(){
  3. document.form1.action="";
  4. }
  5. function funDisagree(){
  6. document.form1.action="2.php";
  7. }
  8. </script><img src="images/detail.jpg" alt="" /></td>
  9. <td width="435"><form id="form1" name="form1" method="post" action="mail.php">
  10. <span class="large">Title(eg.Mr,Mrs,Dr)<br />
  11. </span>
  12. <input name="title" type="text" id="textfield" />
  13. <br>
  14. </label>
  15. <br>
  16. <span class="large">First name *<br />
  17. </span>
  18. <input name="name" type="text" id="textfield2" />
  19. <span class="small">
  20. </label>
  21. (required)</span><br>
  22. <br>
  23. <span class="large">Last name<br />
  24. </span>
  25. <input name="lname" type="text" id="textfield3" />
  26. <br>
  27. <span class="large"> <br>
  28. Address</span><br />
  29. <label>
  30. <textarea name="address" id="textarea" ></textarea>
  31. </label>
  32. <span class="large">
  33. </label>
  34. <br>
  35. <br>
  36. <span class="large">PIN / Post Code</span><br />
  37. <input name="pin" type="text" id="textfield" />
  38. <br>
  39. <br>
  40. <span class="large">Country</span><br />
  41. <input name="country" type="text" id="textfield" />
  42. <br>
  43. <br>
  44. <span class="large"></span> <span class="large"></span> Contact No *
  45. <label> </label>
  46. </span>
  47. <label> <br />
  48. <input name="contact" type="text" id="textfield5" />
  49. </label>
  50. <span class="small">(required)</span><span class="large"><br>
  51. <br>
  52. Email Address *<br />
  53. <label> </label>
  54. </span>
  55. <label>
  56. <input name="email" type="text" id="textfield" >
  57. </label>
  58. <span class="small">(required)</span><br>
  59. <div align="right"><br>
  60. <br>
  61. <label>
  62. <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" >
  63. </label>
  64. </label>
  65. </div>
  66. </form>
  67. this is the first contact page
  68. <script language="javascript">
  69. function funAgree(){
  70. document.form1.action="requirements-form.php";
  71. }
  72. function funDisagree(){
  73. document.form1.action="3.php";
  74. }
  75. </script>
  76. <form id="form1" name="form1" method="post" action="mail.php">
  77. <span class="large">Business name</span>
  78. <input name="business" type="text" id="textfield" />
  79. <br>
  80. <span class="large"></span>
  81. </label>
  82. <span class="large"> <br>
  83. What is the nature of your business ?</span>
  84. <label>
  85. <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
  86. <br>
  87. </label>
  88. <br>
  89. <span class="large">What age group are your products aimed towards?
  90. (e.g. 25-35yrs)</span>
  91. <input name="product" type="text" id="textfield" />
  92. <br>
  93. <span class="large"></span>
  94. </label>
  95. <br>
  96. <span class="large">Number of staff within your organisation </span>
  97. <input name="staff" type="text" id="textfield" />
  98. <br>
  99. <br>
  100. <span class="large">What are your objectives for a new website? </span> <br>
  101. <br>
  102. <label>
  103. <input type="checkbox" name="checkbox" value="a">
  104.  
  105. <span class="large">provide information about the business </span><br>
  106. <label>
  107. <input type="checkbox" name="checkbox2" value="b">
  108. </label>
  109. <span class="large">online selling </span><br>
  110. <label>
  111. <input type="checkbox" name="checkbox3" value="c">
  112. </label>
  113. <span class="large">e-marketing for customers </span><br>
  114. <label>
  115. <input type="checkbox" name="checkbox4" value="d">
  116. </label>
  117. <span class="large">training for staff </span><br>
  118. <label>
  119. <input type="checkbox" name="checkbox5" value="e" checked="checked">
  120.  
  121.  
  122. </label>
  123. <span class="large">Other, please specify <br>
  124. <input name="other" type="text" id="textfield" />
  125. <br>
  126. </span>
  127.  
  128. <span class="large"><br>
  129. <br>
  130. <label> </label>
  131. </span>
  132. <label>
  133. <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()">
  134. </label>
  135. </label>
  136. <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" >
  137. </form>
  138. this is second page..
  139. <script language="javascript">
  140. function funAgree(){
  141. document.form1.action="2.php";
  142. }
  143. function funDisagree(){
  144. document.form1.action="4.php";
  145. }
  146. </script>
  147. <form id="form1" name="form1" method="post" action="mail.php">
  148. <span class="large">Do you currently have a website?<br>
  149. <br>
  150.  
  151. <input type="radio" name="radio" value="1">yes - If 'yes', please specify website address<br>
  152.  
  153. <input name="website" type="text" id="textfield" />
  154. <br>
  155. <span class="large"></span>
  156. </label>
  157. <span class="large">
  158. <label>
  159. <input type="radio" name="radio" value="1"> no - If 'no', what web address would you like?<br>
  160.  
  161. <span class="eg"><em>e.g www.limoservices.co.uk</em> </span><span class="large"><BR>
  162. <input name="no" type="text" id="textfield" />
  163. <br>
  164. <br>
  165. How webpages are required?<br>
  166.  
  167. <label><input type="radio" name="color" value="1" checked>1<br>
  168. <input type="radio" name="color" value="1">1-5<br>
  169. <input type="radio" name="color" value="1">5-25<br>
  170. <input type="radio" name="color" value="1"> large database site with 100's of pages<br>
  171. <input type="radio" name="color" value="1"> not sure <br>
  172.  
  173.  
  174. <br>
  175. What webpages do you want on your website? <BR>
  176. (e.g. galleries, about us, product, services , enquiry form, documents downloads, video etc.) <br>
  177. <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
  178. <br>
  179.  
  180. <label><br>
  181. </label>
  182.  
  183. <span class="large">Do you require web hosting?</span><br>
  184. <input type="radio" name="hosting" value="1" checked>yes<br>
  185. <input type="radio" name="hosting" value="1">no<br>
  186. <input type="radio" name="hosting" value="1">not sure<br>
  187.  
  188. <br>
  189. <span class="large">Do you require an email account?</span><span class="eg"><br>
  190. <em> e.g <a href="mailto:info@limoservices.co.uk">info@limoservices.co.uk</a></em></span>
  191.  
  192. <input name="account" type="text" id="textfield" />
  193. <br>
  194. <br>
  195. <span class="large">Please provide web address links to websites that you would like your website to be similar </span><br>
  196. <br>
  197. <span class="large">Web address 1</span><br>
  198. <input name="web1" type="text" id="textfield" />
  199. <br>
  200. <br>
  201. <span class="large">Explain why you like it </span><br>
  202. <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea><br>
  203. </span><br>
  204. <hr> <br>
  205.  
  206. <span class="large">Web address 2</span><br>
  207. <input name="web2" type="text" id="textfield" />
  208. <br>
  209. <br>
  210.  
  211. <span class="large">Explain why you like it </span><br>
  212. <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea><br><br>
  213. <span class="large">Do you have a logo or brand identity that you would like us to use?</span> <br>
  214. <label>
  215. <input type="radio" name="brand" value="1" checked>yes<br>
  216. <input type="radio" name="brand" value="1">no<br>
  217.  
  218. <br>
  219. <span class="large">Do you have your own digital images that you would like us to use?<br>
  220. <label>
  221. <input type="radio" name="images" value="1" checked>yes<br>
  222. <input type="radio" name="images" value="1">no<br>
  223. <input type="radio" name="images" value="1" checked>i would like help with images<br> <br>
  224.  
  225.  
  226. <span class="large">Do you have the text that is to be used on the website?</span><br>
  227. <label>
  228. <input type="radio" name="text" value="1" checked>yes<br>
  229. <input type="radio" name="text" value="1">no<br>
  230. <input type="radio" name="text" value="1">I would like help with the text<br>
  231.  
  232. <br>
  233. <span class="large">Does your website need to be in any multi-ethnic languages such as Punjabi, Bangladeshi, Urdu, polish, French etc?</span><br>
  234. <label>
  235. <input type="radio" name="lang" value="1" checked>no<br>
  236. <input type="radio" name="lang" value="1">If 'yes', please specify<br>
  237.  
  238. <input name="yes" type="text" id="textfield" />
  239. <br>
  240. <br>
  241.  
  242. <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()">
  243. </label>
  244. </label>
  245. <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" >
  246. </form>
  247. this is 3rd page
  248. <script language="javascript">
  249. function funAgree(){
  250. document.form1.action="3.php";
  251. }
  252. function funDisagree(){
  253. document.form1.action="5.php";
  254. }
  255. </script>
  256. <form id="form1" name="form1" method="post" action="mail.php">
  257. <span class="large">Please select which website features you would like?<br>
  258.  
  259. </span><span class="large">
  260. <label>
  261. <input type="checkbox" name="checkbox" id="checkbox">
  262. </label>
  263. Live video cameras <br>
  264. <label>
  265. <input type="checkbox" name="checkbox2" id="checkbox2">
  266. </label>
  267. Contact form <br>
  268. <label>
  269. <input type="checkbox" name="checkbox3" id="checkbox3">
  270. </label>
  271. Video clips <BR>
  272.  
  273. <label>
  274. <input type="checkbox" name="checkbox4" id="checkbox4">
  275. </label>
  276. Guestbook<br>
  277. <label>
  278. <input type="checkbox" name="checkbox5" id="checkbox5">
  279. </label>
  280. News alerts <br>
  281. <label>
  282. <input type="checkbox" name="checkbox6" id="checkbox6">
  283. </label>
  284. Dynamic picture galleries <br>
  285. <label>
  286. <input type="checkbox" name="checkbox7" id="checkbox7">
  287. </label>
  288. Blog<br>
  289. <label>
  290. <input type="checkbox" name="checkbox8" id="checkbox8">
  291. </label>
  292. Website feedback form <br>
  293. <label>
  294. <input type="checkbox" name="checkbox9" id="checkbox9" checked="checked">
  295. </label>
  296. Virtual tours <br>
  297. <br>
  298. Enter additional website features you require <br>
  299. <label></label><textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
  300. <br>
  301. <br><hr>
  302. <div align="center" class="large"></div>
  303. <br>
  304. Please select which Graphic and designs features you would like<br>
  305. <label>
  306. <input type="checkbox" name="checkbox10" id="checkbox10">
  307. </label>
  308. Brochures<br>
  309. <label>
  310. <input type="checkbox" name="checkbox11" id="checkbox11">
  311. </label>
  312. Business cards<br>
  313. <label>
  314. <input type="checkbox" name="checkbox12" id="checkbox12">
  315. </label>
  316. Flyers<br>
  317. <label>
  318. <input type="checkbox" name="checkbox13" id="checkbox13">
  319. </label>
  320. Pamphlet<br>
  321. <label>
  322. <input type="checkbox" name="checkbox14" id="checkbox14">
  323. </label>
  324. Catalogue<br>
  325. <label>
  326. <input type="checkbox" name="checkbox15" id="checkbox15">
  327. </label>
  328. Letterheads <br>
  329. <label>
  330. <input type="checkbox" name="checkbox16" id="checkbox16">
  331. </label>
  332. Logo designs <br>
  333. <label>
  334. <input type="checkbox" name="checkbox17" id="checkbox17">
  335. </label>
  336. posters<br>
  337. <label>
  338. <input type="checkbox" name="checkbox18" id="checkbox18">
  339. </label>
  340. Compliment slip <br>
  341. <label>
  342. <input type="checkbox" name="checkbox19" id="checkbox19">
  343. </label>
  344. Annual reports <br>
  345. <label>
  346. <input type="checkbox" name="checkbox20" id="checkbox20">
  347. </label>
  348. Newsletters<br>
  349. <label>
  350. <input type="checkbox" name="checkbox21" id="checkbox21" checked="checked">
  351. </label>
  352. Calendar<br>
  353. <br>
  354. Enter additional graphics and design requirements you require <br>
  355. <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
  356. <br>
  357. </span>
  358. <label><br>
  359. </label>
  360.  
  361.  
  362. <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()">
  363. </label>
  364. </label>
  365. <input name="button" type="submit" class="submitCopy" id="button" value="Next" onClick="funDisagree()" >
  366. </form>
  367. this is 4th page
  368. <script language="javascript">
  369. function funAgree(){
  370. document.form1.action="4.php";
  371. }
  372. function funDisagree(){
  373. document.form1.action="mail.php";
  374. }
  375. </script>
  376. <form id="form1" name="form1" method="post" action="mail.php">
  377. <span class="large">How do you want your website updated?<br>
  378.  
  379. <input type="radio" name="website" value="1" checked> I would like help with updating my website <br>
  380. <input type="radio" name="website" value="1"> I will update the website my self<br>
  381. <input type="radio" name="website" value="1"> I would like training on how to update the website<br>
  382. <input type="radio" name="website" value="1" > not sure<br>
  383.  
  384. </span><span class="large">
  385. <label></label>
  386. <br>
  387. How would you rate your computer literacy skills<br>
  388. <label>
  389. <input type="radio" name="skill" value="1" > poor<br>
  390. <input type="radio" name="skill" value="1"> medium<br>
  391. <input type="radio" name="skill" value="1"> good<br>
  392. <input type="radio" name="skill" value="1" checked> excellent<br>
  393.  
  394. <br>
  395. How often does your website need to be updated ?<br>
  396. <label>
  397. <input type="radio" name="update" value="1" checked> not very often<br>
  398. <input type="radio" name="update" value="1"> occasionally<br>
  399. <input type="radio" name="update" value="1"> frequently<br>
  400. <input type="radio" name="update" value="1"> not sure<br>
  401.  
  402. <br>
  403. What sections of your website do you need to update the most<br>
  404. <label></label><textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
  405. <br>
  406. <br><hr>
  407. When do you wish to launch the website ?<br>
  408.  
  409. <label></label>
  410. <label>
  411. <input type="launch" name="launch" id="textfield">
  412. <br>
  413. </label>
  414. <br>
  415. Please enter reference code 10% for discount <br>
  416. <input type="text" name="code" id="textfield">
  417. <br>
  418. <br>
  419. Please enter any other information that you feel is relevant to the project here<br>
  420. <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>
  421. <br>
  422. <br>
  423. 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;"/>
  424. <img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
  425. <br />
  426.  
  427. <!-- if the variable "wrong_code" is sent from previous page then display the error field -->
  428. <?php if(isset($_GET['wrong_code'])){?>
  429. <div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div><br />
  430. <?php ;}?>
  431. </span>
  432. <label><br>
  433. </label>
  434.  
  435.  
  436. <input name="Submit" type="submit" class="prev" id="button" value="Previous" onClick="funAgree()">
  437. </label>
  438. </label>
  439. <input name="button" type="submit" class="submitCopy" id="button2" value="Submit" onClick="funDisagree()" >
  440. </form>
  441. this is 5th page
  442. <?php
  443. $body = "";
  444. foreach($_POST as $key => $value) {
  445. $body .= "$key : $value \n";
  446. }
  447. mail("your-email", "Web site comments", $body, "From: <a href="mailto:webmaster@yahoo.co.uk">webmaster@yahoo.co.uk</a>");
  448. ?>
  449.  
Thanks - Email Send - Done
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,540
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 137
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso

Re: PHP

 
0
  #6
Feb 28th, 2009
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/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - Oopy Doopy Do 2U2!
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: PHP

 
0
  #7
Feb 28th, 2009
i dnt want to merge on a big file, any other solution please....
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,540
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 137
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Posting Virtuoso

Re: PHP

 
0
  #8
Feb 28th, 2009
Then when one file posts to another, include the following code and will convert the $_POST to $_SESSION. But be sure to put session_start(); at the top of your pages.
  1. foreach($_POST AS $keyzz => $valzz) {
  2. $_SESSION[$keyzz]=$valzz;
  3. }
So when you submit the last page, you can then refer to all the previous posts as sessions.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*`
My favourite PC. - Oopy Doopy Do 2U2!
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 58
Reputation: rohnni is an unknown quantity at this point 
Solved Threads: 0
rohnni rohnni is offline Offline
Junior Poster in Training

Re: PHP

 
0
  #9
Feb 28th, 2009
cwarn23 i did update u told me but nothing it only showing 5th page form output not others...
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 19
Reputation: Swapsry is an unknown quantity at this point 
Solved Threads: 0
Swapsry Swapsry is offline Offline
Newbie Poster

Re: PHP

 
0
  #10
Feb 28th, 2009
Originally Posted by rohnni View Post
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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 1629 | Replies: 53
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC