Jump to content

Archived

This topic is now archived and is closed to further replies.

Franchise

Need suggestions please

Recommended Posts

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 this

1st 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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
[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 it

http://www.thecomputermechanics.com/forums/showthread.php?t=16

Share this post


Link to post
Share on other sites
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 database
if (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".

Share this post


Link to post
Share on other sites

×

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.