Jump to content

Inserting a displaying data


hansman

Recommended Posts

Hello, i have a sign up form where i have a field named Counties. I wish to be able to enter data such as "Orange, Southern" and have that stored in the mysql database.

 

However, when i store this, one one of my pages i display Counties. I want Orange and Southern to be two different options. How can i go upon changing the way i enter the data into the database or showing the data?

Link to comment
https://forums.phpfreaks.com/topic/115085-inserting-a-displaying-data/
Share on other sites

Honestly, I just spent the last 10 minutes trying to understand that, but failed. Please explain a little bit clearer. Also, if you want something, code it. As much as we try, we don't just give you scripts. Try coding your own, then we will help you.

 

As far as I can tell, I can't see your problem. Its displaying the counties. If it isn't, then there is something wrong. Fix it. If you can't, post the code, and we will be happy to help you.

ok,

 

so i have my form

County:        <input name="county" type="text" />

 

on the next page it is inserted into the database.

 

On the display results page i grab the data

$query = "SELECT DISTINCT county FROM ad WHERE state='$state' ORDER BY county ASC"; 

and i will use this to generate a link to a specific county.

 

echo "<h2><a href=\"profile.php?id=".$row['county']."\" />".$row['county']." County</a> <br> \n</h2> ";

 

 

 

 

So you have the code.

When I initially type "Orange" into the county name in the form to be stored it works fine.

 

But i would like to figure out how if i put something like "Orange, Bergen" into the county form, mysql can separate those two inputs.

Archived

This topic is now archived and is closed to further replies.

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