butty22 Posted April 19, 2009 Share Posted April 19, 2009 Hey Guys, am new to php and new some help. i have got a form designed for our site(it is really big with various sections on the fom). i have also created multiple tables on the MySql database matching the various sections on this form. my question is how do i link these multiple tables together so that when the form is filled and completed, the data on the form is written to the database. At the moment, when the form is submitted, it currently sends the data to an email address but i would also like it to write to the database for future reference. Note: each of the tables have their individual ids and the total number of tables is about 8. Any help is greatly appreciated. thanks Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/ Share on other sites More sharing options...
jackpf Posted April 19, 2009 Share Posted April 19, 2009 Something like this: mysql_query("INSERT INTO table1,table2,table3 (table1.something, table2.somethingelse, table3.anotherthing) VALUES ('something', 'something', 'something')") or die(mysql_error()); At least, I think you can do that. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-813757 Share on other sites More sharing options...
butty22 Posted April 20, 2009 Author Share Posted April 20, 2009 jackpf, thanks for your suggestion. however, would i be saving this query or is it something that needs to run everytime? am not sure what to do --- or am i meant to insert it into the code for the form? thanks Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-814695 Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 You need to put all your values into the query. Then run it when the form has been submitted. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-814698 Share on other sites More sharing options...
butty22 Posted April 20, 2009 Author Share Posted April 20, 2009 are you suggesting that i include the above code with the values into the code for the form? thanks Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-814750 Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 Do you want to insert it into 1 table or 2? I'm unsure, now rereading your original post. Ok, say you have this: <input type="text" name="something" /> And you want to insert it into your database, do this: $something = $_POST['something']; mysql_query("INSERT INTO yourtable (field) VALUES ('$something')"); I suggest you look up a mysql tutorial if you are unable to adapt this. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-814777 Share on other sites More sharing options...
butty22 Posted April 20, 2009 Author Share Posted April 20, 2009 i actually have 7 tables set up on the database and i want sections of the form to insert into the various tables. i would try your suggestion now and see how it goes. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-814818 Share on other sites More sharing options...
butty22 Posted April 20, 2009 Author Share Posted April 20, 2009 hello i have looked at the code and cant seem to picture where to place the code. is it possible for you to please view the source on appform.spearventures.net and kindly tell me where to place the code? thanks Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-814841 Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 Well, I'd need to see the php. But put it where you process the form. I think you should look up a mysql tutorial. It may make it easier to understand. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-814967 Share on other sites More sharing options...
mandred Posted April 21, 2009 Share Posted April 21, 2009 <?php if (isset($_POST['submitbutton'])) { $value1 = mysql_real_escape_string($_POST['value1']); $value2 = mysql_real_escape_string($_POST['value2']); mysql_query("INSERT INTO table (value1, value2) VALUES ('$value1', '$value2')"); } ?> <html> <head> <title>My Form</title> </head> <body> <form method="post"> <input name="value1" type="text"> <input name="value2" type="text"> <input name="submitbutton" type="submit" value="Submit Form"> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-815200 Share on other sites More sharing options...
jackpf Posted April 21, 2009 Share Posted April 21, 2009 So what's actually not working with that? Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-815365 Share on other sites More sharing options...
butty22 Posted April 21, 2009 Author Share Posted April 21, 2009 i have inserted the code as advised but when i tried to fill the form and clicked submit, nothing was saved on the tables in mysql database. below is the code i used <?php if (isset($_POST['submitbutton'])) { $name=proposeduni = mysql_real_escape_string($_POST['name=proposeduni']); $name=proposedcourse = mysql_real_escape_string($_POST['name=proposedcourse']); mysql_query("INSERT INTO table courses (proposed coluni, proposed course) VALUES ('$name=proposeduni', '$name=proposedcourse')"); } ?> and this is the code for my form thanks Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-815409 Share on other sites More sharing options...
butty22 Posted April 21, 2009 Author Share Posted April 21, 2009 <HTML> <HEAD><TITLE>Spear New Candidate Registration Form</TITLE> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content=Word.Document name=ProgId> <META content="Microsoft Word 12" name=Originator><LINK href="index_files/filelist.xml" rel=File-List><LINK href="index_files/editdata.mso" rel=Edit-Time-Data><LINK href="index_files/oledata.mso" rel=OLE-Object-Data> <STYLE> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </STYLE> <LINK href="index_files/themedata.thmx" rel=themeData><LINK href="index_files/colorschememapping.xml" rel=colorSchemeMapping> <STYLE> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:1627400839 -2147483648 8 0 66047 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman";} p.MsoHeader, li.MsoHeader, div.MsoHeader {mso-style-priority:99; mso-style-unhide:no; mso-style-link:"Header Char"; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:center 225.65pt right 451.3pt; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman";} p.MsoFooter, li.MsoFooter, div.MsoFooter {mso-style-priority:99; mso-style-unhide:no; mso-style-link:"Footer Char"; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:center 225.65pt right 451.3pt; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman";} p.MsoAcetate, li.MsoAcetate, div.MsoAcetate {mso-style-unhide:no; mso-style-link:"Balloon Text Char"; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:8.0pt; font-family:"Tahoma","sans-serif"; mso-fareast-font-family:"Times New Roman";} span.MsoPlaceholderText {mso-style-noshow:yes; mso-style-priority:99; mso-style-unhide:no; color:gray;} span.z-TopofFormChar {mso-style-name:"z-Top of Form Char"; mso-style-priority:99; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:"z-Top of Form"; mso-ansi-font-size:8.0pt; mso-bidi-font-size:8.0pt; font-family:"Arial","sans-serif"; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; display:none; mso-hide:all;} span.z-BottomofFormChar {mso-style-name:"z-Bottom of Form Char"; mso-style-priority:99; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:"z-Bottom of Form"; mso-ansi-font-size:8.0pt; mso-bidi-font-size:8.0pt; font-family:"Arial","sans-serif"; mso-ascii-font-family:Arial; mso-hansi-font-family:Arial; mso-bidi-font-family:Arial; display:none; mso-hide:all;} span.BalloonTextChar {mso-style-name:"Balloon Text Char"; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:"Balloon Text"; mso-ansi-font-size:8.0pt; mso-bidi-font-size:8.0pt; font-family:"Tahoma","sans-serif"; mso-ascii-font-family:Tahoma; mso-hansi-font-family:Tahoma; mso-bidi-font-family:Tahoma;} span.white1 {mso-style-name:white1; mso-style-unhide:no; mso-ansi-font-size:8.5pt; mso-bidi-font-size:8.5pt; color:white; mso-text-animation:none; text-decoration:none; text-underline:none; text-decoration:none; text-line-through:none;} span.text {mso-style-name:text; mso-style-unhide:no;} span.HeaderChar {mso-style-name:"Header Char"; mso-style-priority:99; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:Header; mso-ansi-font-size:12.0pt; mso-bidi-font-size:12.0pt;} span.FooterChar {mso-style-name:"Footer Char"; mso-style-priority:99; mso-style-unhide:no; mso-style-locked:yes; mso-style-link:Footer; mso-ansi-font-size:12.0pt; mso-bidi-font-size:12.0pt;} span.SpellE {mso-style-name:""; mso-spl-e:yes;} span.GramE {mso-style-name:""; mso-gram-e:yes;} /* Page Definitions */ @page {mso-footnote-separator:url("index_files/header.htm") fs; mso-footnote-continuation-separator:url("index_files/header.htm") fcs; mso-endnote-separator:url("index_files/header.htm") es; mso-endnote-continuation-separator:url("index_files/header.htm") ecs;} @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-title-page:yes; mso-header:url("index_files/header.htm") h1; mso-footer:url("index_files/header.htm") f1; mso-paper-source:0;} div.Section1 {page:Section1;} --> </STYLE> </HEAD> <BODY lang=EN-GB style="BACKGROUND: #ffffff; MARGIN: 15px 10px; tab-interval: 36.0pt"> <FORM action="http://www.spearventures.net/cgi-bin/FormMail.pl " method=post><INPUT type=hidden value=edu.enquiries@spearventures.net name=recipient> <INPUT type=hidden value="New Cand Form" name=subject> <INPUT type=hidden value=http://www.spearventures.net name=redirect> <DIV class=Section1> <TABLE class=MsoNormalTable style="WIDTH: 1408px; BORDER-COLLAPSE: collapse; HEIGHT: 26px; mso-border-alt: solid #7BA0CD 1.0pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-insideh: 1.0pt solid #7BA0CD; mso-border-insidev: 1.0pt solid #7BA0CD" cellSpacing=0 cellPadding=0 border=1> <TBODY> <TR> <TD style="BORDER-RIGHT: #7ba0cd 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; BACKGROUND: #a7bfde; PADDING-BOTTOM: 0cm; BORDER-LEFT: #7ba0cd 1pt solid; WIDTH: 426.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #7ba0cd 1pt solid; mso-border-top-alt: solid #7BA0CD 1.0pt" vAlign=top width=568> <P class=MsoNormal style="TEXT-ALIGN: center" align=center><B><SPAN style="FONT-SIZE: 14pt; FONT-FAMILY:" Calibri?,?sans-serif??><FONT color=#0000c0>NEW CANDIDATE REGISTRATION FORM<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></B></P></TD></TR></TBODY></TABLE> <P class=MsoNormal style="tab-stops: 332.25pt"><SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY:" Calibri?,?sans-serif??><SPAN style="mso-spacerun: yes"> </SPAN><SPAN style="mso-spacerun: yes"> </SPAN><o:p></o:p></SPAN></P> <TABLE class=MsoNormalTable style="WIDTH: 100%; mso-yfti-tbllook: 1184; mso-padding-alt: 3.0pt 3.0pt 3.0pt 3.0pt; mso-cellspacing: 1.5pt; mso-table-lspace: 2.25pt; mso-table-rspace: 2.25pt; mso-table-anchor-vertical: paragraph; mso-table-anchor-horizontal: column; mso-table-left: left" cellPadding=0 width="100%" align=left border=0> <TBODY> <TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #1569ad; PADDING-BOTTOM: 3pt; WIDTH: 99.3%; PADDING-TOP: 3pt" width="99%" colSpan=2> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> </SPAN><SPAN class=white1><B><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??>Courses:</SPAN></B></SPAN><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 1"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; WIDTH: 49.26%; PADDING-TOP: 3pt" width="49%"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Proposed University / College:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; WIDTH: 49.68%; PADDING-TOP: 3pt" width="49%"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??><INPUT maxLength=150 size=49 name=proposeduni><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 2"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Proposed Course Title:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??><INPUT maxLength=100 size=49 name=proposedcourse><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 3"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Permanent home address:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??><TEXTAREA name=permaddress cols=37></TEXTAREA><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 13"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Tel:</B> (including dialling codes)<o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??><INPUT size=30 name=tel><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 14"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Fax:</B> (including dialling codes)<o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??><INPUT size=30 name=fax><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 15"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="TEXT-ALIGN: center; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly" align=center><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <INPUT maxLength=255 size=18 name=proname2><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt" vAlign=top> <P class=MsoNormal style="TEXT-ALIGN: center; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly" align=center><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <TEXTAREA name=prosubjects2 cols=24></TEXTAREA><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt" vAlign=top> <P class=MsoNormal style="TEXT-ALIGN: center; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly" align=center><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <INPUT maxLength=255 size=15 name=prolevel2><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt" vAlign=top> <P class=MsoNormal style="TEXT-ALIGN: center; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly" align=center><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <INPUT size=15 name=proyeartaken2><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 21"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #efefef; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt" colSpan=2> <P class=MsoNormal style="MARGIN-BOTTOM: 12pt; mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Work Experience:</B><o:p></o:p></SPAN></P> <TABLE class=MsoNormalTable style="BACKGROUND: #cccccc; WIDTH: 100%; mso-yfti-tbllook: 1184; mso-padding-alt: 3.0pt 3.0pt 3.0pt 3.0pt; mso-cellspacing: .7pt" cellSpacing=1 cellPadding=0 width="100%" border=0> <TBODY> <TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 21.16%; PADDING-TOP: 3pt" width="21%" rowSpan=2> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Job Title:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 21.16%; PADDING-TOP: 3pt" width="21%" rowSpan=2> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Name of<BR> Organisation:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 18.08%; PADDING-TOP: 3pt" width="18%" rowSpan=2> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Full time or<BR> Part time:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 19.28%; PADDING-TOP: 3pt" width="19%" colSpan=2> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>From:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 19.28%; PADDING-TOP: 3pt" width="19%" colSpan=2> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>To:</B><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 1"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 9.42%; PADDING-TOP: 3pt" width="9%"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Month:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 9.7%; PADDING-TOP: 3pt" width="9%"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Year:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 9.42%; PADDING-TOP: 3pt" width="9%"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Month:</B><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; WIDTH: 9.7%; PADDING-TOP: 3pt" width="9%"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <B>Year:</B><o:p></o:p></SPAN></P></TD></TR> <TR style="mso-yfti-irow: 2"> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <INPUT maxLength=255 size=18 name=jobtitle1><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <INPUT maxLength=255 size=18 name=orgname1><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <INPUT maxLength=50 size=11 name=fullpart1><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN style="FONT-SIZE: 8.5pt; COLOR: #333333; FONT-FAMILY:" Arial?,?sans-serif??> <INPUT size=5 name=frommonth1><o:p></o:p></SPAN></P></TD> <TD style="PADDING-RIGHT: 3pt; PADDING-LEFT: 3pt; BACKGROUND: #f7f7f7; PADDING-BOTTOM: 3pt; PADDING-TOP: 3pt"> <P class=MsoNormal style="mso-element: frame; mso-element-frame-hspace: 2.25pt; mso-element-wrap: around; mso-element-anchor-vertical: paragraph; mso-element-anchor-horizontal: column; mso-height-rule: exactly"><SPAN class=text></SPAN><SPAN style="FONT-SIZE: 8pt"></SPAN><SPAN style="FONT-SIZE: 8pt"></SPAN><SPAN style="FONT-SIZE: 8pt"><FONT face="Arial, Helvetica, Sans-Serif"></FONT></SPAN> </P> <P class=MsoNormal><SPAN style="FONT-SIZE: 8pt"><FONT face="Arial, Helvetica, Sans-Serif">Candidate’s Signature:<INPUT value="Put your name here" name=cansig> Date: <INPUT name=cansigdate></FONT> <P></P><INPUT type=submit value=SUBMIT name=submit> </SPAN> <P></P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN> </P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN> </P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??> <TABLE style="LEFT: 116px; POSITION: absolute; TOP: 3819px; BORDER-COLLAPSE: collapse" borderColor=#000000 height=19 cellSpacing=0 cellPadding=0 width=79 border=1> <TBODY> <TR></TD></TR></TBODY></TABLE></SPAN><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN></P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN> </P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN> </P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN> </P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN> </P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??></SPAN> </P> <P class=MsoFooter><SPAN style="FONT-SIZE: 8.5pt; FONT-FAMILY:" Arial?,?sans-serif??>© Spear Ventures Ltd<o:p></o:p></SPAN></P></SPAN><o:p></o:p></SPAN></TD></TR></TBODY></TABLE> <P class=MsoNormal><o:p> </o:p></P> <P class=MsoNormal><o:p> </o:p></P> <P class=MsoNormal><o:p> </o:p></P></DIV></FORM></BODY> Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-815414 Share on other sites More sharing options...
butty22 Posted April 21, 2009 Author Share Posted April 21, 2009 sorry guys had to cut the code short to be able to post it up here but i hope you can still help with it. it is a long code but any help is greatly appreciated because we are keen to get this project moving. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-815416 Share on other sites More sharing options...
jackpf Posted April 21, 2009 Share Posted April 21, 2009 Put or die(mysql_error()); after your query, and see if you get an error. Also, try echoing out your posted variables to see if they are what you think they are. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-815449 Share on other sites More sharing options...
butty22 Posted April 21, 2009 Author Share Posted April 21, 2009 i have tried it again but it still doesnt work...pls can someone help cos i seem to be getting really frustrated here Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-815739 Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 What do you mean it doesn't work? What happens when you post the variables? No errors or anything? Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816256 Share on other sites More sharing options...
butty22 Posted April 22, 2009 Author Share Posted April 22, 2009 at the moment, i have inserted the below code <?php function MySQLDB(){ /* Make connection to database */ $this->connection = mysql_connect(localhost, x_n, x) or die(mysql_error()); mysql_select_db(spearventures_n, $this->connection) or die(mysql_error()); if (isset($_POST['submitbutton'])) { $name=proposeduni = mysql_real_escape_string($_POST['name=proposeduni']); $name=proposedcourse = mysql_real_escape_string($_POST['name=proposedcourse']); mysql_query("INSERT INTO courses (proposed_coluni, proposed_course) VALUES ('$name=proposeduni', '$name=proposedcourse')")or die(mysql_error(); } ?> <HTML> <HEAD><TITLE>Spear New Candidate Registration Form</TITLE> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> however i am getting the attached screen error message [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816288 Share on other sites More sharing options...
Yesideez Posted April 22, 2009 Share Posted April 22, 2009 When asking for help you need to be as specific as possible to the problem and give as much information as possible to help with the issue as none of us here have crystal balls and we can't see your screen. Please post any error messages you're getting and when given a line number, that line of code in the script and the previous view lines as well as errors in PHP can originate from an earlier place in the code. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816303 Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 Yeah, why attach stuff? Can you not just post your error message? I can't even open that file on this pc (I'm at school). And either your haven't posted your entire code, or your connect function is missing a } bracket, and it's half object oriented. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816316 Share on other sites More sharing options...
Yesideez Posted April 22, 2009 Share Posted April 22, 2009 I didn't actually notice the attachment there to be honest but if I had, I'd have mentioned to just copy & paste the error and place it inside QUOTE tags for clarity. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816322 Share on other sites More sharing options...
butty22 Posted April 22, 2009 Author Share Posted April 22, 2009 right at the moment, this is my current code...managed to get rid of the error message but its still not writing to my database...just to clarify wha i want is once the form is submitted, it writes the data within the form to the database as well as emailing the data to us... at the moment the email bit works but it doesnt write to the database... i inserted this code at the beginning of my code before the <html> tags began but it didnt do anything...rightnow it is inserted within the body of the form where i have got form action... <BODY lang=EN-GB style="BACKGROUND: #ffffff; MARGIN: 15px 10px; tab-interval: 36.0pt"> <FORM action="http://www.spearventures.net/cgi-bin/FormMail.pl " method=post><INPUT type=hidden value=edu.enquiries@spearventures.net name=recipient> <INPUT type=hidden value="New Cand Form" name=subject> <INPUT type=hidden value=http://www.spearventures.net name=redirect> <?php if (isset($_POST['submitbutton'])) { $connection = mysql_connect('localhost', 'xxxx','xxxx') or die(mysql_error()); mysql_select_db('spearventures_n', $connection) or die(mysql_error()); $proposeduni = mysql_real_escape_string($_POST['proposeduni']); $proposedcourse = mysql_real_escape_string($_POST['proposedcourse']); mysql_query("INSERT INTO courses (proposed_coluni, proposed_course) VALUES ('$proposeduni', '$proposedcourse')")or die(mysql_error(); } ?> <DIV class=Section1> thanks Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816412 Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 And what happens when you echo out your posted variables? Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816416 Share on other sites More sharing options...
butty22 Posted April 22, 2009 Author Share Posted April 22, 2009 i dont get anything... i have just changed the code to the following <FORM action="http://www.spearventures.net/cgi-bin/FormMail.pl " method=post><INPUT type=hidden value=edu.enquiries@spearventures.net name=recipient> <INPUT type=hidden value="New Cand Form" name=subject> <INPUT type=hidden value=http://www.spearventures.net name=redirect><action="input.php"> and my input.php code is <?php if (isset($_POST['submitbutton'])) { $connection = mysql_connect("localhost", "xxxx","xxxx"); if (!$connection) { die('Could not connect: ' . mysql_error()); } mysql_select_db("spearventures_n", $connection) or die(mysql_error()); $proposeduni = mysql_real_escape_string($_POST['proposeduni']); $proposedcourse = mysql_real_escape_string($_POST['proposedcourse']); $query = "INSERT INTO courses (proposed_coluni, proposed_course) VALUES ('$proposeduni', '$proposedcourse')"; if (mysql_query($query)) { print 'Successfully inserted<br />'; } else { print 'Not inserted<br />'; } // mysql_query } ?> Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816495 Share on other sites More sharing options...
jackpf Posted April 22, 2009 Share Posted April 22, 2009 Well then you're not posting your data properly. There may be nothing wrong with the query, you just need to post the right data properly. Quote Link to comment https://forums.phpfreaks.com/topic/154741-saving-data-from-a-webform/#findComment-816509 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.