Franchise Posted July 15, 2006 Share Posted July 15, 2006 Hey guys,I am looking for a simple, script that I am not sure what it would be called. I need a script that would allow users to leave a message, sort of like a shout. That messagewould then be put in order to form a sentence.Sort of like this1st persons shout is Hi, 2nd is My, 3rd is Name.. etc..and at the bottom of the page 'Hi My Name' appears. Anyone know what script would be able to do this? Quote Link to comment https://forums.phpfreaks.com/topic/14644-need-suggestions-please/ Share on other sites More sharing options...
pixy Posted July 15, 2006 Share Posted July 15, 2006 Do you mean like where people are adding sentances to one single message that appears on the bottom...I can make one really easy, if that's what you're talking about. Do you have a database this can be stored in? Quote Link to comment https://forums.phpfreaks.com/topic/14644-need-suggestions-please/#findComment-58592 Share on other sites More sharing options...
Franchise Posted July 16, 2006 Author Share Posted July 16, 2006 [quote author=pixy link=topic=100636.msg397792#msg397792 date=1152985971]Do you mean like where people are adding sentances to one single message that appears on the bottom...I can make one really easy, if that's what you're talking about. Do you have a database this can be stored in? [/quote]I mean like a word association kind of game, where everyone who comes to the site can add a word, and only 1 word. After they enter the word it then appears at the bottom of the page but in sentence form. Sort of like this if you can see ithttp://www.thecomputermechanics.com/forums/showthread.php?t=16 Quote Link to comment https://forums.phpfreaks.com/topic/14644-need-suggestions-please/#findComment-58742 Share on other sites More sharing options...
pixy Posted July 16, 2006 Share Posted July 16, 2006 If you have a database, this is essentially what you'd do. Asumming you access the "associations" through stories.php?id=123 where 123 is the "association" being worked on.[code]<?php// Connect to databaseif (isset($_GET['id'])) { if (!is_numeric($_GET['id'])) { die('you stupid hacker'); } else { $id = $_GET['id']; }}$query = "SELECT story FROM stories WHERE story_id='$id'";$result = mysql_query($query);$row = myqsl_fetch_array($result, MYSQL_NUM);$story = $row[0];if (isset($_POST['story'])) { if (empty($_POST['word'])) { die('you did not enter a word'); } else { $word = $_POST['word']; $storyid = $_POST['story']; $newstory = ' '.$word; $query = "UPDATE stories SET story='$newstory' WHERE story_id='$story_id'"; $result = mysql_query($query); if ($result) { echo 'Thanks for adding your word to story story.<br> <a href="stories.php?id='.$story_id.'">View updated story!</a>'; } else { echo 'There has been an error.'; } }}else { echo $story . '<br>Would you like to add to this story: <form action="stories.php" method="post"> <b>Add a Word:</b> <input type="text" name="word"> <input type="hidden" name="story" value="'.$id.'"> <input type="submit" name="submit" value="Add Word"></form>';}?>[/code]You'd need a database and a table called stories with fields "story_id" and "story". Quote Link to comment https://forums.phpfreaks.com/topic/14644-need-suggestions-please/#findComment-59102 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.