Jump to content

submitting a form within a form


downah
 Share

Recommended Posts

Hi guys, as shown in the code I have a form running in another form, the first form submits to updateprofile.php but within that I have got another submit button and another form which should submit to updatepassword.php, but when I click the button which should take the action to updatepassword.php it still takes me through to updateprofile.php, so for some reason the 2nd form is not recognizable? any help here?

 

<?php

include "connect.php";
echo '<p><a href="index.php">Home</a></p>';
if(isset($_SESSION['email']))
$email = $_SESSION['email'];

{
$result = mysql_query("SELECT id, email, firstname, lastname, website, address1, address2, city, postcode, phone, county, dobmonth, dobday, dobyear, Sex, Level, services, philosophy, mission, customerpromises, coursesundertaken, othercourses, nongolfcert, crbcheck, firstaid, latestcpd, cpdgoals, mostinfluential, mainstrength, yeargolfexperience, customerfeedback, wgtffeedback FROM member WHERE email = '$email'")
or die(mysql_error());
while($row = mysql_fetch_array($result))
{
?>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js"></script>
<form onsubmit='return formValidator()' id='register' action='updateprofile.php' method='post' accept-charset='UTF-8'>
<body id="main_body" >

<img id="top" src="top.png" alt="">
<div id="form_container">

<h1>Add a Member</h1>
	<form id="form_362567" class="appnitro"  method="post" action="">
				<div class="form_description">
		<h2> My Profile</h2>
		<p></p>
	</div>						
		<ul >

				<li class="section_break">
		<h3>Login Details</h3>
		<p></p>
	</li>		<li id="li_2" >
	<label class="description" for="email">Email: </label>
	<div>
		<input id="email" name="email" class="element text medium" type="text" maxlength="255" value="<?php echo $row['email']; ?>"/> 
	</div> 
	</li>	<form onsubmit='' id='update' action='updatepassword.php' method='post' accept-charset='UTF-8'>
<li id="li_3" >
	<label class="description" for="password">Old Password </label>
	<div>
		<input id="oldpassword" name="oldpassword" class="element text medium" type="password" maxlength="255" value=""/> 
	</div> 
	</li>		<li id="li_4" >
	<label class="description" for="confirmpw">New Password: (Must be between 6-50 characters) </label>
	<div>
		<input id="newpassword" name="newpassword" class="element text medium" type="text" maxlength="255" value=""/> 
	</div> 
	</li>		
	<li id="li_4" >
	<label class="description" for="confirmpw">Confirm New Password: </label>
	<div>
		<input id="confirmnewpassword" name="confirmnewpassword" class="element text medium" type="text" maxlength="255" value=""/> <br><input type='submit' name='Submit' value='Update Password' />
	</div> </form>
	</li><li class="section_break">
		<h3>Personal Details</h3>
		<p></p>
	</li>		<li id="li_6" >
	<label class="description" for="element_6">Name: </label>
	<span>
		<input id="firstname" name= "firstname" class="element text" maxlength="255" size="8" value="<?php echo $row['firstname']; ?>"/>
		<label>First</label>
	</span>
	<span>
		<input id="lastname" name= "lastname" class="element text" maxlength="255" size="14" value="<?php echo $row['lastname']; ?>"/>
		<label>Last</label>
	</span> 
	</li>		<li id="li_7" >
	<label class="description" for="website">Web Site: </label>
	<div>
		<input id="website" name="website" class="element text medium" type="text" maxlength="255" value="<?php echo $row['website']; ?>"/> 
	</div> 
	</li>		<li id="li_12" >
	</li>		<li id="li_11" >
	<label class="description" for="element_11">Contact Details </label>

	<div>
		<input id="address1" name="address1" class="element text large" value="<?php echo $row['address1']; ?>" type="text">
		<label for="element_11_1">Street Address</label>
	</div>

	<div>
		<input id="address2" name="address2" class="element text large" value="<?php echo $row['address2']; ?>" type="text">
		<label for="element_11_2">Address Line 2</label>
	</div>

	<div class="left">
		<input id="city" name="city" class="element text medium" value="<?php echo $row['city']; ?>" type="text">
		<label for="element_11_3">City</label>
	</div>

	<div class="right">
		<input id="phone" name="phone" class="element text medium" value="<?php echo $row['phone']; ?>" type="text">
		<label for="element_11_4">Phone Number</label>
	</div>

	<div class="left">
		<input id="postcode" name="postcode" class="element text medium" maxlength="15" value="<?php echo $row['postcode']; ?>" type="text">
		<label for="element_11_5">Postcode</label>
	</div>

	<div class="right">
		<select class="element select medium" id="county" name="county"> 
		<option value="<?php echo $row['county']; ?>" selected="selected"><?php echo $row['county']; ?></option>
<optgroup label="England"> <option>Bedfordshire</option> <option>Berkshire</option> <option>Bristol</option> <option>Buckinghamshire</option> <option>Cambridgeshire</option> <option>Cheshire</option> <option>City of London</option> <option>Cornwall</option> <option>Cumbria</option> <option>Derbyshire</option> <option>Devon</option> <option>Dorset</option> <option>Durham</option> <option>East Riding of Yorkshire</option> <option>East Sussex</option> <option>Essex</option> <option>Gloucestershire</option> <option>Greater London</option> <option>Greater Manchester</option> <option>Hampshire</option> <option>Herefordshire</option> <option>Hertfordshire</option> <option>Isle of Wight</option> <option>Kent</option> <option>Lancashire</option> <option>Leicestershire</option> <option>Lincolnshire</option> <option>Merseyside</option> <option>Norfolk</option> <option>North Yorkshire</option> <option>Northamptonshire</option> <option>Northumberland</option> <option>Nottinghamshire</option> <option>Oxfordshire</option> <option>Rutland</option> <option>Shropshire</option> <option>Somerset</option> <option>South Yorkshire</option> <option>Staffordshire</option> <option>Suffolk</option> <option>Surrey</option> <option>Tyne and Wear</option> <option>Warwickshire</option> <option>West Midlands</option> <option>West Sussex</option> <option>West Yorkshire</option> <option>Wiltshire</option> <option>Worcestershire</option> </optgroup> <optgroup label="Wales"> <option>Anglesey</option> <option>Brecknockshire</option> <option>Caernarfonshire</option> <option>Carmarthenshire</option> <option>Cardiganshire</option> <option>Denbighshire</option> <option>Flintshire</option> <option>Glamorgan</option> <option>Merioneth</option> <option>Monmouthshire</option> <option>Montgomeryshire</option> <option>Pembrokeshire</option> <option>Radnorshire</option> </optgroup> <optgroup label="Scotland"> <option>Aberdeenshire</option> <option>Angus</option> <option>Argyllshire</option> <option>Ayrshire</option> <option>Banffshire</option> <option>Berwickshire</option> <option>Buteshire</option> <option>Cromartyshire</option> <option>Caithness</option> <option>Clackmannanshire</option> <option>Dumfriesshire</option> <option>Dunbartonshire</option> <option>East Lothian</option> <option>Fife</option> <option>Inverness-shire</option> <option>Kincardineshire</option> <option>Kinross</option> <option>Kirkcudbrightshire</option> <option>Lanarkshire</option> <option>Midlothian</option> <option>Morayshire</option> <option>Nairnshire</option> <option>Orkney</option> <option>Peeblesshire</option> <option>Perthshire</option> <option>Renfrewshire</option> <option>Ross-shire</option> <option>Roxburghshire</option> <option>Selkirkshire</option> <option>Shetland</option> <option>Stirlingshire</option> <option>Sutherland</option> <option>West Lothian</option> <option>Wigtownshire</option> </optgroup> <optgroup label="Northern Ireland"> <option>Antrim</option> <option>Armagh</option> <option>Down</option> <option>Fermanagh</option> <option>Londonderry</option> <option>Tyrone</option> </optgroup>

		</select>
	<label for="element_11_6">County</label>

</div> <br>
<label for='dob' class="element text medium" >Date of Birth:</label><br>

<select name="dobmonth" id="dobmonth">
<option value="<?php echo $row['dobmonth']; ?>" selected="selected"><?php echo $row['dobmonth']; ?></option>
<option value="January">January</option>
<option value="Febuary">Febuary</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>

<select name="dobday" id="dobday">
<option value="<?php echo $row['dobday']; ?>" selected="selected"><?php echo $row['dobday']; ?></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>

<select name="dobyear" id="dobyear">
<option value="<?php echo $row['dobyear']; ?>" selected="selected"><?php echo $row['dobyear']; ?></option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
<option value="1989">1989</option>
<option value="1988">1988</option>
<option value="1987">1987</option>
<option value="1986">1986</option>
<option value="1985">1985</option>
<option value="1984">1984</option>
<option value="1983">1983</option>
<option value="1982">1982</option>
<option value="1981">1981</option>
<option value="1980">1980</option>
<option value="1979">1979</option>
<option value="1978">1978</option>
<option value="1977">1977</option>
<option value="1976">1976</option>
<option value="1975">1975</option>
<option value="1974">1974</option>
<option value="1973">1973</option>
<option value="1972">1972</option>
<option value="1971">1971</option>
<option value="1970">1970</option>
<option value="1969">1969</option>
<option value="1968">1968</option>
<option value="1967">1967</option>
<option value="1966">1966</option>
<option value="1965">1965</option>
<option value="1964">1964</option>
<option value="1963">1963</option>
<option value="1962">1962</option>
<option value="1961">1961</option>
<option value="1960">1960</option>
<option value="1959">1959</option>
<option value="1958">1958</option>
<option value="1957">1957</option>
<option value="1956">1956</option>
<option value="1955">1955</option>
<option value="1954">1954</option>
<option value="1953">1953</option>
<option value="1952">1952</option>
<option value="1951">1951</option>
<option value="1950">1950</option>
<option value="1949">1949</option>
<option value="1948">1948</option>
<option value="1947">1947</option>
<option value="1946">1946</option>
<option value="1945">1945</option>
<option value="1944">1944</option>
<option value="1943">1943</option>
<option value="1942">1942</option>
<option value="1941">1941</option>
<option value="1940">1940</option>
<option value="1939">1939</option>
<option value="1938">1938</option>
<option value="1937">1937</option>
<option value="1936">1936</option>
<option value="1935">1935</option>
<option value="1934">1934</option>
<option value="1933">1933</option>
<option value="1932">1932</option>
<option value="1931">1931</option>
<option value="1930">1930</option>
<option value="1929">1929</option>
<option value="1928">1928</option>
<option value="1927">1927</option>
<option value="1926">1926</option>
<option value="1925">1925</option>
<option value="1924">1924</option>
<option value="1923">1923</option>
<option value="1922">1922</option>
<option value="1921">1921</option>
<option value="1920">1920</option>
<option value="1919">1919</option>
<option value="1918">1918</option>
<option value="1917">1917</option>
<option value="1916">1916</option>
<option value="1915">1915</option>
<option value="1914">1914</option>
<option value="1913">1913</option>
<option value="1912">1912</option>
<option value="1911">1911</option>
<option value="1910">1910</option>
<option value="1909">1909</option>
<option value="1908">1908</option>
<option value="1907">1907</option>
<option value="1906">1906</option>
<option value="1905">1905</option>
<option value="1904">1904</option>
<option value="1903">1903</option>
<option value="1902">1902</option>
<option value="1901">1901</option>
<option value="1900">1900</option>
</select><br><br>

	</li>		<li id="li_29" >
	<label class="description" for="element_29">Sex: </label>
	<div>
	<select class="element select medium" id="Sex" name="Sex"> 
		<option value="<?php echo $row['Sex']; ?>" selected="selected"><?php echo $row['Sex']; ?></option>
<option value="Male" >Male</option>
<option value="Female" >Female</option>

	</select>

	</div> 
	</li>		<li class="section_break">
		<h3>Experience</h3>
		<p></p>
	</li>		<li id="li_15" >
	<label class="description" for="element_15">Level: </label>
	<div>
		<input id="Level" name="Level" class="element text small" type="text" maxlength="255" value="<?php echo $row['Level']; ?>"/> 
	</div> 
	</li>		<li id="li_14" >
	<label class="description" for="element_14">Services Offered: </label>
	<div>
		<textarea id="services" name="services" class="element textarea medium"><?php echo $row['services']; ?></textarea> 
	</div> 
	</li>		<li id="li_16" >
	<label class="description" for="element_16">Philosophy: </label>
	<div>
		<textarea id="philosophy" name="philosophy" class="element textarea medium"> <?php echo $row['philosophy']; ?> </textarea> 
	</div> 
	</li>		<li id="li_17" >
	<label class="description" for="element_17">Mission Statement: </label>
	<div>
		<textarea id="mission" name="mission" class="element textarea medium"><?php echo $row['mission']; ?></textarea> 
	</div> 
	</li>		<li id="li_18" >
	<label class="description" for="element_18">Customer promises above WGTF promises: </label>
	<div>
		<textarea id="customerpromises" name="customerpromises" class="element textarea medium"><?php echo $row['customerpromises']; ?></textarea> 
	</div> 
	</li>		<li id="li_19" >
	<label class="description" for="element_19">Courses undertaken through WGTF: </label>
	<div>
		<textarea id="coursesundertaken" name="coursesundertaken" class="element textarea medium"><?php echo $row['coursesundertaken']; ?></textarea> 
	</div> 
	</li>		<li id="li_20" >
	<label class="description" for="element_20">Other Courses: </label>
	<div>
		<textarea id="othercourses" name="othercourses" class="element textarea medium"><?php echo $row['othercourses']; ?></textarea> 
	</div> 
	</li>		<li id="li_21" >
	<label class="description" for="element_21">Other non-golf Certifications: </label>
	<div>
		<textarea id="nongolfcert" name="nongolfcert" class="element textarea medium"><?php echo $row['nongolfcert']; ?></textarea> 
	</div> 
	</li>		<li id="li_30" >
	<label class="description" for="element_30">CRB Checked: </label>
	<div>
	<select class="element select small" id="crbcheck" name="crbcheck"> 
		<option value="<?php echo $row['crbcheck']; ?>" selected="selected"><?php echo $row['crbcheck']; ?></option>
<option value="Yes" >Yes</option>
<option value="No" >No</option>

	</select>
	</div> 
	</li>		<li id="li_31" >
	<label class="description" for="element_31">First Aid Certified: </label>
	<div>
	<select class="element select small" id="firstaid" name="firstaid"> 
		<option value="<?php echo $row['firstaid']; ?>" selected="selected"><?php echo $row['firstaid']; ?></option>
<option value="Yes" >Yes</option>
<option value="No" >No</option>

	</select>
	</div> 
	</li>		<li id="li_22" >
	<label class="description" for="element_22">Latest CPD: </label>
	<div>
		<textarea id="latestcpd" name="latestcpd" class="element textarea medium"><?php echo $row['latestcpd']; ?></textarea> 
	</div> 
	</li>		<li id="li_23" >
	<label class="description" for="element_23">CPD Goals: </label>
	<div>
		<textarea id="cpdgoals" name="cpdgoals" class="element textarea medium"><?php echo $row['cpdgoals']; ?></textarea> 
	</div> 
	</li>		<li id="li_24" >
	<label class="description" for="element_24">Most Influential Coach or Player: </label>
	<div>
		<input id="mostinfluential" name="mostinfluential" class="element text medium" type="text" maxlength="255" value="<?php echo $row['mostinfluential']; ?>"/> 
	</div> 
	</li>		<li id="li_25" >
	<label class="description" for="element_25">Main Strengths: </label>
	<div>
		<textarea id="mainstrength" name="mainstrength" class="element textarea medium"><?php echo $row['mainstrength']; ?></textarea> 
	</div> 
	</li>		<li id="li_26" >
	<label class="description" for="element_26">Years' Golfing Experience: </label>
	<div>
		<input id="yeargolfexperience" name="yeargolfexperience" class="element text small" type="text" maxlength="255" value="<?php echo $row['yeargolfexperience']; ?>"/> 
	</div> 
	</li>		<li id="li_27" >
	<label class="description" for="element_27">Customer Feedback Rating: </label>
	<div>
		<input id="customerfeedback" name="customerfeedback" class="element text small" type="text" maxlength="255" value="<?php echo $row['customerfeedback']; ?>"/> 
	</div> 
	</li>		<li id="li_28" >
	<label class="description" for="element_28">WGTF Rating: </label>
	<div>
		<input id="wgtffeedback" name="wgtffeedback" class="element text small" type="text" maxlength="255" value="<?php echo $row['wgtffeedback']; ?>"/> 
	</div> 
	</li>


  <input type='submit' name='Submit' value='Update Profile' />
</form>
		<div id="footer">

	</div>
</div>
<img id="bottom" src="bottom.png" alt="">
</body>



<?php
}



}




?>

 

Much appreciated

Link to comment
Share on other sites

<form onsubmit='return formValidator()' id='register' action='updateprofile.php' method='post' accept-charset='UTF-8'>

 

is inside the first form-->  <form onsubmit='' id='update' action='updatepassword.php' method='post' accept-charset='UTF-8'>

 

I don't really understand what you mean I am sorry.. I thought both forms with different submit buttons would update to a different validate form, could you explain further what you mean with that?

Link to comment
Share on other sites

Without looking closely at your project, I will say this...

When dealing with multiple records to be updated, input names COULD BE an array by adding [] after the name of the input tag.  So let's say you have a field named "firstname".  The input would look like this.

<input type="text" name="firstname[]" value="<?php echo "{$row['firstname']}"; ?>" />

 

I would have a hidden input for the userid, also setup as an array eg. name="userid[]" etc.

 

Adding print_r($_POST); will then show an array for each "POST" input.

echo "<pre>";
print_r($_POST);
echo "</pre>";

If you look closely you will see that the array keys (in brackets) match for each user record.  So in other words

 

You would then use a foreach statement to get the keys and values based on the userid.  Here's a basic example.

 

foreach($_POST['userid'] as $id => $v){
$userfirst=$_POST['userfirst'][$id];
$userlast=$_POST['userlast'][$id];
//You then do an mysql update WHERE userid='$id' within this loop.
}

Link to comment
Share on other sites

OH there were so many things wrong with the posted code with nesting issues.  Here's an untested  revision that's stripped of all those li tags.  At least it's closer to validating and should process two separate forms.

<?php
include "connect.php";
if(isset($_SESSION['email'])){
$email = $_SESSION['email'];

$result = mysql_query("SELECT id, email, firstname, lastname, website, address1, address2, city, postcode, phone, county, dobmonth, dobday, dobyear, Sex, Level, services, philosophy, mission, customerpromises, coursesundertaken, othercourses, nongolfcert, crbcheck, firstaid, latestcpd, cpdgoals, mostinfluential, mainstrength, yeargolfexperience, customerfeedback, wgtffeedback FROM member WHERE email = '$email'") or die(mysql_error());
$row = mysql_fetch_row($result))
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="view.css" media="all">
<script type="text/javascript" src="view.js">
</script>
</head>
<body>
<img id="top" src="top.png" alt="" name="top">
<p><a href="index.php">Home</a></p>
<form onsubmit='return formValidator()' id='register' action='updateprofile.php' method='post' accept-charset='UTF-8' name="register">
<div id="form_container">
<h1>Add a Member</h1>
<div class="form_description">
<h2> My Profile</h2>
</div>
<h3>Login Details</h3>
<label class="description" for="email">Email:</label>
<div><input id="email" name="email" class="element text medium" type="text" maxlength="255" value="<?php echo $row['email']; ?>"></div>

<label class="description" for="password">Old Password</label>
<div><input id="oldpassword" name="oldpassword" class="element text medium" type="password" maxlength="255" value=""></div>

<label class="description" for="confirmpw">New Password: (Must be between 6-50 characters)</label>
<div><input id="newpassword" name="newpassword" class="element text medium" type="text" maxlength="255" value=""></div>

<label class="description" for="confirmpw">Confirm New Password:</label>
<div><input id="confirmnewpassword" name="confirmnewpassword" class="element text medium" type="text" maxlength="255" value=""><br>

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

<h3>Personal Details</h3>

<label class="description" for="element_6">Name:</label> 
<div>
<span><input id="firstname" name="firstname" class="element text" maxlength="255" size="8" value="<?php echo $row['firstname']; ?>"> <label>First</label></span> 

<span><input id="lastname" name="lastname" class="element text" maxlength="255" size="14" value="<?php echo $row['lastname']; ?>"> <label>Last</label></span> 
</div>
<label class="description" for="website">Web Site:</label>
<div><input id="website" name="website" class="element text medium" type="text" maxlength="255" value="<?php echo $row['website']; ?>"></div>

<label class="description" for="element_11">Contact Details</label>
<div><input id="address1" name="address1" class="element text large" value="<?php echo $row['address1']; ?>" type="text"> <label for="element_11_1">Street Address</label></div>

<div><input id="address2" name="address2" class="element text large" value="<?php echo $row['address2']; ?>" type="text"> <label for="element_11_2">Address Line 2</label></div>

<div class="left"><input id="city" name="city" class="element text medium" value="<?php echo $row['city']; ?>" type="text"> <label for="element_11_3">City</label></div>

<div class="right"><input id="phone" name="phone" class="element text medium" value="<?php echo $row['phone']; ?>" type="text"> <label for="element_11_4">Phone Number</label></div>

<div class="left"><input id="postcode" name="postcode" class="element text medium" maxlength="15" value="<?php echo $row['postcode']; ?>" type="text"> <label for="element_11_5">Postcode</label></div>

<div class="right">
<select class="element select medium" id="county" name="county">
<option value="<?php echo $row['county']; ?>" selected="selected"><?php echo $row['county']; ?></option>
<optgroup label="England">
<option>Bedfordshire</option>
<option>Berkshire</option>
<option>Bristol</option>
<option>Buckinghamshire</option>
<option>Cambridgeshire</option>
<option>Cheshire</option>
<option>City of London</option>
<option>Cornwall</option>
<option>Cumbria</option>
<option>Derbyshire</option>
<option>Devon</option>
<option>Dorset</option>
<option>Durham</option>
<option>East Riding of Yorkshire</option>
<option>East Sussex</option>
<option>Essex</option>
<option>Gloucestershire</option>
<option>Greater London</option>
<option>Greater Manchester</option>
<option>Hampshire</option>
<option>Herefordshire</option>
<option>Hertfordshire</option>
<option>Isle of Wight</option>
<option>Kent</option>
<option>Lancashire</option>
<option>Leicestershire</option>
<option>Lincolnshire</option>
<option>Merseyside</option>
<option>Norfolk</option>
<option>North Yorkshire</option>
<option>Northamptonshire</option>
<option>Northumberland</option>
<option>Nottinghamshire</option>
<option>Oxfordshire</option>
<option>Rutland</option>
<option>Shropshire</option>
<option>Somerset</option>
<option>South Yorkshire</option>
<option>Staffordshire</option>
<option>Suffolk</option>
<option>Surrey</option>
<option>Tyne and Wear</option>
<option>Warwickshire</option>
<option>West Midlands</option>
<option>West Sussex</option>
<option>West Yorkshire</option>
<option>Wiltshire</option>
<option>Worcestershire</option>
</optgroup>
<optgroup label="Wales">
<option>Anglesey</option>
<option>Brecknockshire</option>
<option>Caernarfonshire</option>
<option>Carmarthenshire</option>
<option>Cardiganshire</option>
<option>Denbighshire</option>
<option>Flintshire</option>
<option>Glamorgan</option>
<option>Merioneth</option>
<option>Monmouthshire</option>
<option>Montgomeryshire</option>
<option>Pembrokeshire</option>
<option>Radnorshire</option>
</optgroup>
<optgroup label="Scotland">
<option>Aberdeenshire</option>
<option>Angus</option>
<option>Argyllshire</option>
<option>Ayrshire</option>
<option>Banffshire</option>
<option>Berwickshire</option>
<option>Buteshire</option>
<option>Cromartyshire</option>
<option>Caithness</option>
<option>Clackmannanshire</option>
<option>Dumfriesshire</option>
<option>Dunbartonshire</option>
<option>East Lothian</option>
<option>Fife</option>
<option>Inverness-shire</option>
<option>Kincardineshire</option>
<option>Kinross</option>
<option>Kirkcudbrightshire</option>
<option>Lanarkshire</option>
<option>Midlothian</option>
<option>Morayshire</option>
<option>Nairnshire</option>
<option>Orkney</option>
<option>Peeblesshire</option>
<option>Perthshire</option>
<option>Renfrewshire</option>
<option>Ross-shire</option>
<option>Roxburghshire</option>
<option>Selkirkshire</option>
<option>Shetland</option>
<option>Stirlingshire</option>
<option>Sutherland</option>
<option>West Lothian</option>
<option>Wigtownshire</option>
</optgroup>
<optgroup label="Northern Ireland">
<option>Antrim</option>
<option>Armagh</option>
<option>Down</option>
<option>Fermanagh</option>
<option>Londonderry</option>
<option>Tyrone</option>
</optgroup>
</select>
<label for="element_11_6">County</label>
</div>
<br>
<label for='dob' class="element text medium">Date of Birth:</label><br>
<select name="dobmonth" id="dobmonth">
<option value="<?php echo $row['dobmonth']; ?>" selected="selected"><?php echo $row['dobmonth']; ?></option>
<option value="January">January</option>
<option value="Febuary">Febuary</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select> 
<select name="dobday" id="dobday">
<option value="<?php echo $row['dobday']; ?>" selected="selected"><?php echo $row['dobday']; ?></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select> 
<select name="dobyear" id="dobyear">
<option value="<?php echo $row['dobyear']; ?>" selected="selected"><?php echo $row['dobyear']; ?></option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
<option value="1991">1991</option>
<option value="1990">1990</option>
<option value="1989">1989</option>
<option value="1988">1988</option>
<option value="1987">1987</option>
<option value="1986">1986</option>
<option value="1985">1985</option>
<option value="1984">1984</option>
<option value="1983">1983</option>
<option value="1982">1982</option>
<option value="1981">1981</option>
<option value="1980">1980</option>
<option value="1979">1979</option>
<option value="1978">1978</option>
<option value="1977">1977</option>
<option value="1976">1976</option>
<option value="1975">1975</option>
<option value="1974">1974</option>
<option value="1973">1973</option>
<option value="1972">1972</option>
<option value="1971">1971</option>
<option value="1970">1970</option>
<option value="1969">1969</option>
<option value="1968">1968</option>
<option value="1967">1967</option>
<option value="1966">1966</option>
<option value="1965">1965</option>
<option value="1964">1964</option>
<option value="1963">1963</option>
<option value="1962">1962</option>
<option value="1961">1961</option>
<option value="1960">1960</option>
<option value="1959">1959</option>
<option value="1958">1958</option>
<option value="1957">1957</option>
<option value="1956">1956</option>
<option value="1955">1955</option>
<option value="1954">1954</option>
<option value="1953">1953</option>
<option value="1952">1952</option>
<option value="1951">1951</option>
<option value="1950">1950</option>
<option value="1949">1949</option>
<option value="1948">1948</option>
<option value="1947">1947</option>
<option value="1946">1946</option>
<option value="1945">1945</option>
<option value="1944">1944</option>
<option value="1943">1943</option>
<option value="1942">1942</option>
<option value="1941">1941</option>
<option value="1940">1940</option>
<option value="1939">1939</option>
<option value="1938">1938</option>
<option value="1937">1937</option>
<option value="1936">1936</option>
<option value="1935">1935</option>
<option value="1934">1934</option>
<option value="1933">1933</option>
<option value="1932">1932</option>
<option value="1931">1931</option>
<option value="1930">1930</option>
<option value="1929">1929</option>
<option value="1928">1928</option>
<option value="1927">1927</option>
<option value="1926">1926</option>
<option value="1925">1925</option>
<option value="1924">1924</option>
<option value="1923">1923</option>
<option value="1922">1922</option>
<option value="1921">1921</option>
<option value="1920">1920</option>
<option value="1919">1919</option>
<option value="1918">1918</option>
<option value="1917">1917</option>
<option value="1916">1916</option>
<option value="1915">1915</option>
<option value="1914">1914</option>
<option value="1913">1913</option>
<option value="1912">1912</option>
<option value="1911">1911</option>
<option value="1910">1910</option>
<option value="1909">1909</option>
<option value="1908">1908</option>
<option value="1907">1907</option>
<option value="1906">1906</option>
<option value="1905">1905</option>
<option value="1904">1904</option>
<option value="1903">1903</option>
<option value="1902">1902</option>
<option value="1901">1901</option>
<option value="1900">1900</option>
</select><br>
<br>
<label class="description" for="element_29">Sex:</label>
<div>
<select class="element select medium" id="Sex" name="Sex"> 
<option value="<?php echo $row['Sex']; ?>" selected="selected"><?php echo $row['Sex']; ?></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select></div>
<h3>Experience</h3>
<label class="description" for="element_15">Level:</label>
<div><input id="Level" name="Level" class="element text small" type="text" maxlength="255" value="<?php echo $row['Level']; ?>"></div>
<label class="description" for="element_14">Services Offered:</label>
<div>
<textarea id="services" name="services" class="element textarea medium"><?php echo $row['services']; ?></textarea></div>
<label class="description" for="element_16">Philosophy:</label>
<div>
<textarea id="philosophy" name="philosophy" class="element textarea medium"><?php echo $row['philosophy']; ?></textarea></div>
<label class="description" for="element_17">Mission Statement:</label>
<div>
<textarea id="mission" name="mission" class="element textarea medium"><?php echo $row['mission']; ?></textarea></div>
<label class="description" for="element_18">Customer promises above WGTF promises:</label>
<div>
<textarea id="customerpromises" name="customerpromises" class="element textarea medium"><?php echo $row['customerpromises']; ?></textarea></div>
<label class="description" for="element_19">Courses undertaken through WGTF:</label>
<div>
<textarea id="coursesundertaken" name="coursesundertaken" class="element textarea medium"><?php echo $row['coursesundertaken']; ?></textarea></div>
<label class="description" for="element_20">Other Courses:</label>
<div>
<textarea id="othercourses" name="othercourses" class="element textarea medium"><?php echo $row['othercourses']; ?></textarea></div>
<label class="description" for="element_21">Other non-golf Certifications:</label>
<div>
<textarea id="nongolfcert" name="nongolfcert" class="element textarea medium"><?php echo $row['nongolfcert']; ?></textarea></div>
<label class="description" for="element_30">CRB Checked:</label>
<div><select class="element select small" id="crbcheck" name="crbcheck"> 
<option value="<?php echo $row['crbcheck']; ?>" selected="selected"><?php echo $row['crbcheck']; ?></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></div>
<label class="description" for="element_31">First Aid Certified:</label>
<div><select class="element select small" id="firstaid" name="firstaid">
<option value="<?php echo $row['firstaid']; ?>" selected="selected"><?php echo $row['firstaid']; ?></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></div>
<label class="description" for="element_22">Latest CPD:</label>
<div>
<textarea id="latestcpd" name="latestcpd" class="element textarea medium"><?php echo $row['latestcpd']; ?></textarea></div>
<label class="description" for="element_23">CPD Goals:</label>
<div>
<textarea id="cpdgoals" name="cpdgoals" class="element textarea medium"><?php echo $row['cpdgoals']; ?></textarea></div>
<label class="description" for="element_24">Most Influential Coach or Player:</label>
<div><input id="mostinfluential" name="mostinfluential" class="element text medium" type="text" maxlength="255" value="<?php echo $row['mostinfluential']; ?>"></div>
<label class="description" for="element_25">Main Strengths:</label>
<div>
<textarea id="mainstrength" name="mainstrength" class="element textarea medium"><?php echo $row['mainstrength']; ?></textarea></div>
<label class="description" for="element_26">Years' Golfing Experience:</label>
<div><input id="yeargolfexperience" name="yeargolfexperience" class="element text small" type="text" maxlength="255" value="<?php echo $row['yeargolfexperience']; ?>"></div>
<label class="description" for="element_27">Customer Feedback Rating:</label>
<div><input id="customerfeedback" name="customerfeedback" class="element text small" type="text" maxlength="255" value="<?php echo $row['customerfeedback']; ?>"></div>
<label class="description" for="element_28">WGTF Rating:</label>
<div><input id="wgtffeedback" name="wgtffeedback" class="element text small" type="text" maxlength="255" value="<?php echo $row['wgtffeedback']; ?>"></div>
<input type='submit' name='Submit' value='Update Profile'></form>
<?php
}
?>
<div id="footer"></div>
<img id="bottom" src="bottom.png" alt="" name="bottom">
</body>
</html>

Link to comment
Share on other sites

In your code there is one form which ends after the password, but that is the wrong form, the whole profile (all input except passwords also email though) should go to the updateprofile.php which you have, and just the passwords should go to updatepassword.php, or should I just stop this completely and have updatepassword running in updateprofile so it is in one validation file?

Link to comment
Share on other sites

Deleted all the forms except one and put it all into one validation page while having 2 submit buttons

 

if(isset($_POST['updateprofile']))

 

{

//code to update profile

}

else if (isset($_POST['updatepassword']))

 

{

//code to update password

}

 

Thanks s3cr3t I finally understood hehe

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

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.

 Share

×
×
  • 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.