Jump to content

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
}

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.