steevz Posted January 14, 2010 Share Posted January 14, 2010 I would like a comment script where users can leave a name and their country. When the comment appears under the topic, I would like the script to show their name, their country's flag, and then their comment. Right now I don't know if it would be required to have them sign up first? I'm new to this and any suggestions would be greatly appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/188488-is-this-comment-script-possible/ Share on other sites More sharing options...
eugene2009 Posted January 14, 2010 Share Posted January 14, 2010 try googling "ip geolocation" its possible.. Quote Link to comment https://forums.phpfreaks.com/topic/188488-is-this-comment-script-possible/#findComment-995118 Share on other sites More sharing options...
mikesta707 Posted January 14, 2010 Share Posted January 14, 2010 if you let the user input what country they are from (from a drop down box or something) then you won't need geolocation. The data you get might be a little off (as a user can lie) but thats probably not a big deal. and No, you wouldn't need to have people sign up (obviously this depends on your comment system. I'm assuming anonymous posting is allowed) you would just have a drop down box with a bunch of countries listed. You can then make a folder with a bunch of images of the flags named after their country. In the drop down, each item's value could be the name of the image for that flag (without the extension). For example, the japanese flag could be in a folder called Flags/ and could be named Japan.jpg. In your drop down box, for japan you would just have something like <select> .... <option value="Japan">Japan</option> ... </select> then in the PHP script itself, you can use that value as the name of the file. I don't know how you store comments in your database, but you can either add html directly in the comment body, or have a column that stores which country they are from, then use that as the image source, like $q = "SELECT * from Comments Where ...."; //other sql stuff while($row = mysql_fetch_array($result){ //display flag $flag = $row['country']; echo '<img src="'.$flag.'.jpg" />'; // etc } Quote Link to comment https://forums.phpfreaks.com/topic/188488-is-this-comment-script-possible/#findComment-995126 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.