Code2Design.com

User login

The Layout

Programming

Graphic Design

Resources

Navigation

C2D Projects

Unsystematic Affiliates

Pixel Digest Pixel Designz Tutorial Mix Flash Valley 

Change Language

Who's online

There are currently 0 users and 23 guests online.

Struggling to create a mysql form

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 .

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>


Submitted by phill104 on June 16, 2007 - 11:04am.
printer friendly version

After a little research I

After a little research I have found the almost perfect answer.

To anyone who needs a form and cannot face the coding, try this

http://phpformgen.sourceforge.net


Cool new Idea for forms

Thanks for the info about the site phill104!

If anyone ever gets tired of making forms I will have them stop by phpformgen. Also, if anyone wants to learn more they have a video at http://phpformgen.sourceforge.net/video/phpformgen.html you can watch.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <br /> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use BBCode tags in the text, URLs will be automatically converted to links
More information about formatting options



Like what you see?

Why not add more? C2D is looking for other Christian Web Masters who would like to help write articles for this site. If you have expericance in FLASH, CSS/HTML, PHP/MySQL, PhotoShop/GIMP, Blender, Javascript, or just General Design - our users would love to hear what you have to say. Contact Us

delicious   digg   reddit   magnoliacom   newsvine   furl   google   yahoo   technorati