Jump to content

Need suggestions please


Franchise

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?
Link to comment
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?
Link to comment
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

Link to comment
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".
Link to comment
Share on other sites

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.