logo
Published on Code2Design (http://code2design.com)

Struggling to create a mysql form

By phill104
Created Jun 16 2007 - 11:04am

I'm struggling with mysql here.

I decided to create a google map that users can update themselves for my windsurfing website http://www.windsurf.me.uk [1] .

I've worked out how to read the details from a database to position the pointers and display the details but I now wish to create a form that users can fill in that will update the mysql database with those details.

Here is a simple html form that I put together as an example of how it would work but this is where I get stuck.

<script language='javascript'>
function verifyMe(){
var msg='';

if(document.getElementById('categort').value==''){
msg+='- Category\n\n';}

if(document.getElementById('Name').value==''){
msg+='- Name\n\n';}

if(document.getElementById('street').value==''){
msg+='- Street\n\n';}

if(document.getElementById('town').value==''){
msg+='- Town\n\n';}

if(document.getElementById('postcode').value==''){
msg+='- Post Code\n\n';}

if(document.getElementById('long').value==''){
msg+='- Longditude\n\n';}

if(document.getElementById('lat').value==''){
msg+='- Latitude\n\n';}

if(document.getElementById('details').value==''){
msg+='- Input a link to your shop, webcam or personal site here\n\n';}

if(document.getElementById('review').value==''){
msg+='- Tell us about your venue, site or webcam here\n\n';}

if(msg!=''){
alert('The following fields are empty or invalid:\n\n'+msg);
return false
}else{
return true }

}
</script>
<form name='Mapform' action='Mysql' method='POST' enctype='multipart/form-data' onsubmit='return verifyMe();'>
<table class='table_form_1' id='table_form_1' cellspacing='0'>
<tr>
<td class='ftbl_row_1' ><LABEL for='categort' ACCESSKEY='none' ><b style='color:red'>*</b>Category
</td>
<td class='ftbl_row_1a' ><select name='categort' id='categort'>
<option value='Windsurfing Location'>Windsurfing Location</option>
<option value=' Webcam'> Webcam</option>
<option value=' Shop'> Shop</option>
<option value=' Your Location'> Your Location</option>
</select>
</td>
</tr>
<tr>
<td class='ftbl_row_2' ><LABEL for='Name' ACCESSKEY='none' ><b style='color:red'>*</b>Name
</td>
<td class='ftbl_row_2a' ><input type='text' name='Name' id='Name' size='45' value=''>
</td>
</tr>
<tr>
<td class='ftbl_row_1' ><LABEL for='street' ACCESSKEY='none' ><b style='color:red'>*</b>Street
</td>
<td class='ftbl_row_1a' ><input type='text' name='street' id='street' size='45' value=''>
</td>
</tr>
<tr>
<td class='ftbl_row_2' ><LABEL for='town' ACCESSKEY='none' ><b style='color:red'>*</b>Town
</td>
<td class='ftbl_row_2a' ><input type='text' name='town' id='town' size='45' value=''>
</td>
</tr>
<tr>
<td class='ftbl_row_1' ><LABEL for='postcode' ACCESSKEY='none' ><b style='color:red'>*</b>Post Code
</td>
<td class='ftbl_row_1a' ><input type='text' name='postcode' id='postcode' size='45' value=''>
</td>
</tr>
<tr>
<td class='ftbl_row_2' ><LABEL for='long' ACCESSKEY='none' ><b style='color:red'>*</b>Longditude
</td>
<td class='ftbl_row_2a' ><input type='text' name='long' id='long' size='45' value=''>
</td>
</tr>
<tr>
<td class='ftbl_row_1' ><LABEL for='lat' ACCESSKEY='none' ><b style='color:red'>*</b>Latitude
</td>
<td class='ftbl_row_1a' ><input type='text' name='lat' id='lat' size='45' value=''>
</td>
</tr>
<tr>
<td class='ftbl_row_2' ><LABEL for='details' ACCESSKEY='none' ><b style='color:red'>*</b>Input a link to your shop, webcam or personal site here
</td>
<td class='ftbl_row_2a' ><input type='text' name='details' id='details' size='45' value=''>
</td>
</tr>
<tr>
<td valign='top' class='ftbl_row_1' ><LABEL for='review' ACCESSKEY='none' ><b style='color:red'>*</b>Tell us about your venue, site or webcam here
</td>
<td class='ftbl_row_1a' ><textarea name='review' id='review' cols='35' rows='6' value=''></textarea>
</td>
</tr>
<tr>
<td colspan='2' align='right'><input type='submit' name='submit' value='Submit'>&nbsp;<input type='reset' name='reset' value='Reset'><br /> </td>
</tr>
</table>
</form>

‹ Error trap [1] php.ini setting? › [1]

Source URL:
http://code2design.com/forums/struggling_to_create_a_mysql_form