Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18
  1. #1
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    god dammit! plz help.

    How do you make a text box with a submit button that will place their submittions inside the website with a link to what they entered.

    like these forums, but not this big, all i want is for one page. FOr example, submitting jokes. :classic:
    Ad space - for sale, $19.95/month

  2.  

  3. #2
    Senior Member splufdaddy's Avatar
    Join Date
    Feb 2003
    Location
    Boston, MA
    Posts
    4,488
    Member #
    735
    I can understand your frustration, but titling your thread like you have does not make anyone more likely to help you. I've renamed it to a more specific topic so people will know what you're looking for just by viewing the thread title.

  4. #3
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    Check out the guestbook at my site. I think that may be what you are looking for.

    Here are some code snippets of how that works:
    Code:
    <!-- Sign the Guestbook - gbooks.htm -->
    <html>
    <head>
    <script type="text/javascript" language="JavaScript">
    <!--
    
    // -->
    </script>
    <style type="text/css">
    <!--
    BODY	{scrollbar-face-color: #A7A7A7;
    	 scrollbar-base-color: #A7A7A7; 
    	 scrollbar-arrow-color: #66FF00;
    	 scrollbar-DarkShadow-Color: #A7A7A7;
    	 scrollbar-Highlight-Color: #0000FF;
    	 scrollbar-Shadow-Color: #0000FF;
    	 scrollbar-Track-Color: #A7A7A7;
    	 background-color: #A7A7A7;
    	 color: #333399;
    	 font-family: "Comic Sans MS"}
    A	{color: #FF3300; text-decoration: none}
    A:hover	{color: #FFFF00; background-color: #0000FF}
    input	{background-color: #A7A7A7; border-color: #000000;
    	 color: #333399}
    textarea {background-color: #A7A7A7; border-color: #000000;
    	  color: #333399; overflow: hidden}
    -->
    </style>
    </head>
    
    <body vlink="#FFF000" onContextMenu="return false" topmargin=0 leftmargin=0
     scroll="auto" onLoad="document.form1.fullName.focus()">
    <div align="center">
    <h2>Sign the Guestbook</h2>
    <form action="sign.php" method="post" name="form1" onReset="this.fullName.focus()">
    <table border=0 cellpadding=5 cellspacing=5>
    <tr>
     <td valign="top">Name: <font color="#FF000000">*</font></td>
     <td><input type="text" name="fullName" length=10 maxlength=15></td>
    </tr>
    <tr>
     <td valign="top">e-mail:</td>
     <td><input type="text" name="eName" length=8></td>
    </tr>
    <tr>
     <td valign="top">Location:</td>
     <td><input type="text" name="loc" length=10></td>
    </tr>
    <tr>
     <td valign="top">Website:</td>
     <td><input type="text" name="site" value="http://"></td>
    </tr>
    <tr>
     <td valign="top">Comments: <font color="#FF000000">*</font></td>
     <td><textarea cols=40 rows=10 name="comments"></textarea></td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td valign="middle" ><input type="submit" value="Submit"> <input type="reset"></td>
    </tr>
    </table>
    </form>
    <font color="#FF000000">*</font> - Required field.
    </div>
    </body>
    
    </html>
    and here's the php that posts the info to the (View the Guestbook) gbookv.htm:
    PHP Code:
    <!-- sign.php -->
    <?php

        
    if ((!$fullName) || (!$comments)) { // required fields
            
    header("Location: gbooks.htm");
            exit;
        }

    ?>
    <html>
    <head>
    <title>Your Entry</title>
    <style type="text/css">
    <!--
    BODY    {scrollbar-face-color: #A7A7A7;
         scrollbar-base-color: #A7A7A7; 
         scrollbar-arrow-color: #66FF00;
         scrollbar-DarkShadow-Color: #A7A7A7;
         scrollbar-Highlight-Color: #0000FF;
         scrollbar-Shadow-Color: #0000FF;
         scrollbar-Track-Color: #A7A7A7;
         background-color: #A7A7A7;
         color: #333399;
         font-family: "Comic Sans MS"}
    A    {color: #FF3300; text-decoration: none}
    A:hover    {color: #FFFF00; background-color: #0000FF}
    .d1    {border-color: #000000; background-color: #A7A7A7;
         color: 333399; width: 300px; height: 100px
         border-style: thin}
    -->
    </style>
    </head>
    <body vlink="#FFF000" onContextMenu="return false" topmargin=0 leftmargin=0
     scroll="auto">
    <?php
        $IP 
    getenv("REMOTE_ADDR"); 
        
    $today date("F j, Y, g:i a");
        
    $newfile fopen("gbookv.htm","a+"); // connects to a file for read/write 
        
    $comments stripslashes($comments); // remove the escape slash for ' and "
        
    $comments nl2br($comments); // "translates" new lines into <BR> tags
        
    $HTML "<BR>
            <font size=-1>
            <div align='center'>
            <fieldset style='width: 400px'>
            <legend>
    $today</legend>
            <!-- 
    $IP -->
            <table border=0 cellpadding=5 cellspacing=5>
            <tr>
             <td valign='top'>Name:</td>
        "
    ;
        if (
    $eName) { // if email is specified create and email link around the name
            
    $HTML .= "
             <td><a href='mailto:
    $eName'>$fullName</a><BR></td>
            "
    ;
        } else { 
    // else write the name w/o the link
            
    $HTML .= "
             <td>
    $fullName</td>
            "
    ;
        }
        
    $HTML .= "
            </tr>
            <tr>
        "
    ;
        if (
    $loc) { // if location is specified, write the location
            
    $HTML .= "
             <td valign='top'>Location:</td>
             <td>
    $loc</td>
            </tr>
            <tr>
            "
    ;
        }
        if (
    $site) { // write the website address if specified
            
    if ($site != "http://") { // if the url is not the default
                
    if (!strchr($site,"http://")) {
                
    // if the url doesn't begin with "http://" add it to the link and
                // display the address w/o "http://"
                    
    $siteurl "http://" $site;
                    
    $HTML .= "
                     <td valign='top'>Website:</td>
                     <td><a href='
    $siteurl' target='blank'>$site</a></td>
                    </tr>
                    <tr>
                    "
    ;
                } else { 
    // display url as entered
                    
    $HTML .= "
                     <td valign='top'>Website:</td>
                     <td><a href='
    $site' target='blank'>$site</a></td>
                    </tr>
                    <tr>
                    "
    ;
                }
            }
        }
        
    $HTML .= "
             <td valign='top'>Comments:</td>
             <td><div id='d1'>
               
    $comments
             </div></td>
            </tr>
            </table>
            </legend>
            </div></font><BR>
        "
    ;
        
    fwrite($newfile,$HTML); // adds entry to the end of the file
        
    fclose($newfile); // closes the conection
        
    ?>
    <table border=0 width=100% height=100%>
     <tr><td align="center" valign="center">
      Your Entry is being added.<BR>
      You will be redirected in 5 seconds.<BR>
      <a href="gbookv.htm">Click here if you can't wait</a>
     </td></tr>
    </table>
    <script language="JavaScript" type="text/javascript">
     setTimeout("location.replace('gbookv.htm')",3000);
     // redirect to "View the Guestbook" page after 3 seconds
    </script>
    </body>
    </html>
    Hope that helps.
    - Brian

  5. #4
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    Keep in mind that with skrlin's way of doing this, the information is saved into a text file. You could also save the information to a database of some kind, which in the long run would give you extra functionality.
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  6. #5
    Senior Member iphong's Avatar
    Join Date
    Mar 2003
    Location
    Arlington, VA
    Posts
    751
    Member #
    916
    skrlin: He just asked a simple question, there is no need a long code like that. it made him harder to understand.
    Vu Tuan Phong
    iPhongDesign

    http://iphong.com
    http://adstudio1.com

  7. #6
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    i just want sumthing basic. when some1 enters a submission, it puts it there as a link
    Ad space - for sale, $19.95/month

  8. #7
    Senior Member iphong's Avatar
    Join Date
    Mar 2003
    Location
    Arlington, VA
    Posts
    751
    Member #
    916
    For that work just a simple code can handle it. here is the instructions:
    Make a file name text.html with blank content, then make a new file name "index.php" where the submited text will be shown.
    Write this into index.php:
    PHP Code:
    <HTML>
    <BODY>
    Submited text:
    <? include ("text.html"?>
    <form action="submit.php" method="post">
    <textarea name="text"><textarea>
    <input type="submit" value="submit">
    </form>
    </BODY>
    </HTML>
    Make file name submit.php and put this inside:

    PHP Code:
    <?
    $content 
    $_POST['text'];
    $text "<table width="500" align="center"><tr><td>$content</td></tr></table>";

    $filehandle fopen("text.html""a");
    fputs($filehandle"$text") or die("cant put in contents");
    fclose($filehandle);
    echo 
    "Your post has been added, now taking you back to main page....
    <javascript type="
    text/javascript"> Location="index.php"; </script>
    "
    ;
    ?>
    Save this file, make sure that your folder must be chmod to 777 before running this script.
    Vu Tuan Phong
    iPhongDesign

    http://iphong.com
    http://adstudio1.com

  9. #8
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    and text.html is the? main page?
    Ad space - for sale, $19.95/month

  10. #9
    Senior Member krazy's Avatar
    Join Date
    Apr 2003
    Location
    California
    Posts
    543
    Member #
    1078
    didnt werk

    http://killerinstincts.servegame.com/app


    fixed one of them, which was:
    Code:
    <HTML>
    <BODY>
    Submited text:
    <? include ("text.html") ?>
    <form action="submit.php" method="post">
    <textarea name="text"><textarea>
    <input type="submit" value="submit">
    </form>
    </BODY>
    </HTML>
    u for got to close the <textarea>

    but now it dont work when submitting
    Ad space - for sale, $19.95/month

  11. #10
    Senior Member iphong's Avatar
    Join Date
    Mar 2003
    Location
    Arlington, VA
    Posts
    751
    Member #
    916
    what did it display? remember to chmod your folder to 777 before running.
    Vu Tuan Phong
    iPhongDesign

    http://iphong.com
    http://adstudio1.com


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:45 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com