SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old March 4th, 2008, 05:19 AM
Hbabe Hbabe is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 1 Hbabe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 38 sec
Reputation Power: 0
Unhappy Radio button data and combining fields into a MySQL DB

Hi, I am trying to add data to a mysql db from an html form using text boxes and radio buttons.

I have already got another page working using just text boxes, and this page works when I remove the radio buttons, but when I add them it doesnt submit the data and returns my exception error 'Error, insert query failed' (php code that doesnt work is preceded by // - value is 'txtssl')

Also, I want to combine values from two sets of drop down boxes to make two decimal fields of size (2,1) and (2,2) respectively.(not sure if this is the correct way to do it?, though code only returns 9.9 or 9.0 no matter what value I select from the drop down box) also preceded by // - values txtHeight and txtAge

I cant find any exampes on the web specifically for my issues, so if anyone can help it would be appreciated.

Code im using is:

PHP code:
Code:
<?php
					if(isset($_POST['btnRegister']) || $errmsg != '')
					{
						include 'config.php';
						include 'opendb.php';

						$txtHorseName = $_POST['txtHorseName'];
						//$txtHeight = $_POST['HeightH']+$_POST['HeightI'];
						$txtBreed = $_POST['Breed'];
						$txtPrice = $_POST['txtPrice'];
						$txtColour = $_POST['Colour'];
						//$txtAge = $_POST['txtAddressLine1']+$_POST['txtAddressLine1'];
						$txtSex = $_POST['Sex'];
						$txtDescription = $_POST['txtAreaDesc'];
						$txtlocation = $_POST['Location'];
						//$txtSSL = $_POST['SSL'];
						
						$query = "INSERT INTO horse (name, height, breed, price, colour, age, sex, description, location, createDate, sSl) VALUES ('$txtHorseName', '$txtHeight', '$txtBreed', '$txtPrice', '$txtColour', '$txtAge',  '$txtSex', '$txtDescription', '$txtLocation', NOW(), $txtSSL)";
						mysql_query($query) or die('Error, insert query failed');

						$query = "FLUSH PRIVILEGES";
						mysql_query($query) or die('Error, insert query failed');

						include 'closedb.php';
						echo "<p class ='text2'>Your user details have been added.</p>";
					}
					else
					{
				?>



Form HTML code:

Code:
<form method="post" name="frmRegister" id="frmRegister">
					<table width="300" align="left" cellspacing = "7">
						<tr>
							<td width="150"><p class="text3">Horse&nbsp;Name</p></td>
							<td><input name="txtHorseName" type="text" id="txtHorseName"></td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Height:</p></td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Hands*</p></td>
							<td><select name="HeightH">
									<option value=""></option>
									<option value="6">6</option>
									<option value="7">7</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Inches*</p></td>
							<td><select name="HeightI">
									<option value=""></option>
									<option value=".0">0</option>
									<option value=".1">1</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Breed*</p></td>
							<td><select name="Breed">
									<option value=""></option>
									<option value="Akhal Teke">Akhal Teke</option>
									<option value="Andalusian">Andalusian</option>
									<option value="Anglo Arab">Anglo Arab</option>
									<option value="Appaloosa">Appaloosa</option>
									<option value="Arab">Arab</option>
									<option value="Belgian Warmblood">Belgian Warmblood</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Price*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;£</p></td>
							<td><input name="txtPrice" type="text" id="txtPrice"></td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Colour*</p></td>
							<td><select name="Colour">
									<option value=""></option>
									<option value="Appaloosa">Appaloosa</option>
									<option value="Bay">Bay</option>
									<option value="Bay Roan">Bay Roan</option>
									<option value="Black">Black</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Age:</p></td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Years*</p></td>
							<td><select name="AgeY">
									<option value=""></option>
									<option value="0">0</option>
									<option value="1">1</option>
									<option value="2">2</option>
									<option value="3">3</option>
									<option value="4">4</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Months*</p></td>
							<td><select name="AgeM">
									<option value=""></option>
									<option value="0.0">0</option>
									<option value="0.1">1</option>
									<option value="0.2">2</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Sex*</p></td>
							<td><select name="Sex">
								<option value=""></option>
								<option value="Mare">Mare</option>
								<option value="Gelding">Gelding</option>
								<option value="Stallion">Stallion</option>
								<option value="Filly">Filly</option>
								<option value="Colt">Colt</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Description</p></td>
							<td><textarea cols="20" rows="6" name="txtAreaDesc" wrap="HARD"></textarea></td>
						</tr>
						<tr>
							<td width="150"><p class="text3">Location</p></td>
							<td><select name="Location">
								<option value=""></option>
								<option value="Greater London">Greater London</option>
								<option value="South West England">South West England</option>
								<option value="South East England">South East England</option>
								<option value="The Midlands">The Midlands</option>
								<option value="North East England">North East England</option>
								<option value="North West England">North West England</option>
								<option value="East Anglia">East Anglia</option>
								<option value="Scotland">Scotland</option>
								<option value="Northern Ireland">Northern Ireland</option>
								<option value="Wales">Wales</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="150"><p class="text3">This&nbsp;horse&nbsp;is&nbsp;for*:</p></td>
						</tr>
						<tr>
							<td width="150">
								<p class="text3">Sale</p><input type="radio" name="SSL" value="Sale">
							</td>
						</tr>
						<tr>
							<td width="150">
								<p class="text3">Share</p><input type="radio" name="SSL" value="Share">
							</td>
						</tr>
						<tr>
							<td width="150">
								<p class="text3">Loan</p><input type="radio" name="SSL" value="Loan">
							</td>
						</tr>
						<tr>
							<td width="150">&nbsp;</td>
							<td><input type="submit" id="btnRegister" name="btnRegister" value="Register"></td>
						</tr>
					</table>
				</form>
				<p class ="text2">Fields with a * are mandatory</p>
			
				<?php
				}
				?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Radio button data and combining fields into a MySQL DB


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway