i need function :

i want to make game to figure the word meaning e.g:

when i wrote a abcdf i want to convert to bacfd
and when the page refresh again its change again to another word and never convert to
the original word "abcdf "

and i want to support Arabic letters to like
أ ب ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ك م ن ي و م ل
ؤ ء ئ ى ة ق ف غ ع ه ذ

thanks a lot i learned a lot from this forum

Recommended Answers

All 3 Replies

So you want an allagram/conjectural where php can get a word and mix up the letters and upon request get those mixed up letters and put them back into a meaningful word. Is that correct? If so why don't you just store each word to jumbled text as being generated by the user in a database so when the user checks the inserts the text all you need to do is look up on the database.

i don't understand can u give me a code example

Something along the lines of the following demonstrates what I was talking about.

<?php
if (isset($_POST) && !empty($_POST)) {
mysql_connect('localhost','root','');
mysql_select_db('mydb');

mysql_query('INSERT INTO `table` SET `allagram`="'.mysql_real_escape_string($_POST['a']).'", `word`="'.mysql_real_escape_string($_POST['word']).'"') or die(mysql_error());
}
?><form method="POST">
Word:  <input type="text" value="abcd" name="word" placeholder="abcd" /><br />
Allagram: <input type="text" name="a" value="acbd" placeholder="acbd" />
<input type="submit" value="Submit" />
</form>
if (isset($_POST) && !empty($_POST)) {
mysql_connect('localhost','root','');
mysql_select_db('mydb');
$r=mysql_query('SELECT * FROM `table` WHERE `allagram`="'.mysql_real_escape_string($_POST['a']).'"') or die(mysql_error());
$row=mysql_fetch_assoc($r);
echo $row['word'].'<br />';
}
?>
<form method="POST">
Allagram: <input type="text" name="a" value="" placeholder="acbd" />
<input type="submit" value="Submit"
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.