Jump to content

Recommended Posts

Hi Guys,

 

I have created a html which consist of a list of check box and open text comment.


<html>  
<body>  
   <form action="" method="post" enctype="multipart/form-data">  
   <div style="width:200px;border-radius:6px;margin:0px auto">  
<table border="1">  
<tr><td>Name</td><td><input name="name"/></td></tr>
   <tr>  
      <td colspan="2">Select Technolgy:</td>  
   </tr>  
   <tr>  
      <td>PHP</td>  
      <td><input type="checkbox" name="techno[]" value="PHP"></td>  
   </tr>  
   <tr>  
      <td>.Net</td>  
      <td><input type="checkbox" name="techno[]" value=".Net"></td>  
   </tr>  
   <tr>  
      <td>Java</td>  
      <td><input type="checkbox" name="techno[]" value="Java"></td>  
   </tr>  
   <tr>  
      <td>Javascript</td>  
      <td><input type="checkbox" name="techno[]" value="javascript"></td>  
   </tr> 
<tr>
<td>Comments</td>
<td><input name="comment"/></td>
</tr> 
   <tr>  
      <td colspan="2" align="center"><input type="submit" value="submit" name="sub"></td>  
   </tr>  
</table>  
</div>  
</form>  
 
</body>  
</html>  

I manage to store the check box and comment in a database.

 

post-179514-0-91461300-1453002646_thumb.png

 

I store each submit check box in a same column of data and i separated the multiple check box value with comma. My question is, how to turn those data, how can i compare those value and generate a report like this?

 

post-179514-0-40270900-1453002823_thumb.png

Edited by FooKelvin

Your doing it wrong. You dont store the data like that in the same column. You need another table with a foreign key to the first table and do a JOIN. Look up database normalization.

 

Do you mean i cannot store those check box value with comma in a same row? 

Do you mean i cannot store those check box value with comma in a same row? 

You can if you want to do it wrong and go against proper database design and create headaches for yourself and any other developers that has to deal with it down the road as well as anyone offering you help.

 

I gave you a starting point. Look up database normalization and learn it. It is a very important foundation to database design and is one of the simplest things you can master in as little as 10 minutes.

 

Come back with your normalized structure if you are still stuck and we will be happy to help you.

 

* You also didn't post your code, just the form. We cant review what we cant see.

Edited by benanamen
This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

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