Jump to content

Is this comment script possible?


steevz

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/188488-is-this-comment-script-possible/
Share on other sites

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
}

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.