Announcement

Collapse
No announcement yet.

Link form to another webpage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Link form to another webpage

    Hello!

    Is it possible to create a form (including the following fields: Name, date, "comments area") that sends all the information that has been submitted by a visitor to a separate (or even to the same page that holds the form) page, instead of sending it to an email adress??
    I am planning to make a site with a day-by-day description of my last round-trip in America, and I tought it would be nice that visitors have the opportunity to post comments or suggestions in this way...

    Thanks,

    Kenneth

  • #2
    Re: Link form to another webpage

    yes it is possible, but you need to use a mysql database and need a script in PHP or PERL. If you don't know how to program in the languages (I assume you don't otherwise you would have just made a script) you should try looking for one on a site like hotscripts.com, or use vodabids or similar freelance site and have one made.

    Also, a forum might fit your needs... create a topic in your forum about the trip, and then make a webpage about the trip and at the end say "Post comments here"... and then make the word "here" a link to the topic you made in the forum

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

    Comment


    • #3
      Re: Link form to another webpage

      Why not use the guest book feature? Sounds like that would work fine.

      Andy
      PHP- is a blast!

      Comment


      • #4
        Re: Link form to another webpage

        Actually, the site will also contain information about other trips I have made. So I was thinking of a home page with a link to each of these trips. After following one of these links, the visitor will be redirected to a page that contains links to each travel day (day 1, day2,...). Each of these pages will contain a short travel story, a route map, some images, and comments that have been posted by visitors. Because these comments often refer to pictures or a quote in the travel story , I thought it would be more convenient to use a form instead of a guestbook...

        Comment


        • #5
          Re: Link form to another webpage

          Pfff, I'm still struggling with guestbooks and comment forms... I think I'm to dumb for this stuff...

          Comment


          • #6
            Re: Link form to another webpage

            Hi Andy,

            I'm not sure if Kinnie's idea is similar to mine....I was toying with the idea of creating a page where clients can choose the products from a combobox, eg. circuit breakers, then proceed to select the preferred manufacturer (eg. GE) for circuit breaker in another combobox. Then I create a "Next" button that will bring the client to the enquiry page where "Circuit Breakers" & "GE" will be displayed and the client will then begin to enter his requirement for GE's circuit breaker in a TextArea for ratings, quantity, application blah blah blah. After completing all the required fileds in the enquiry page, click "Send" and it goes to my email with all the info.

            Reason for this is I have a long list of products which I have categorized them according to different application and manufacturers. This is to allow people to go straight into the cat. of their interest and post an enquiry without scrolling thru' a long list of products and manfacturers.

            Appreciate your advice and thanks in advance.
            (: Read Only The Good Stuff And Your Day Will Be Blessed :)

            Comment


            • #7
              Re: Link form to another webpage

              yangman,

              Currently- Only one item may be choosen and sent from a combo box and sent via php. Even if you select- allow multiple choices. BV is working on this problem.

              And yes you can have a "multi" page form. Really it is only one page- the form is stretched to be very long and when the viewer/user hits next- they are taken to another part of the form. Here is an example with instructions.
              http://netisopen.com/computer/TF002/T002.html

              I believe this is what you are talking about. If not give a post back but make it another thread.

              Cheers,

              Andy
              PHP- is a blast!

              Comment


              • #8
                Re: Link form to another webpage

                Kinnie,
                Aside form the ability to post pictures- you are referring to a quest book type appliaction. Give that a try. The one in BV Fantastico is -well , fantastic.

                Post back with any specific problems.

                Andy
                PHP- is a blast!

                Comment


                • #9
                  Re: Link form to another webpage

                  Thanks for your comments Andy.
                  I have found a comments script at http://www.allsyntax.com/tutorials/P...s-Script/1.php and I think this is what I need! Didn't find the time to try it yet...

                  But I have the following questions:

                  Do I only have to paste the code using the HTML tool and then change the file extension to php in page properties?

                  Also, the script connects to the database using <? require_once($_SERVER['DOCUMENT_ROOT'].'/database_connect.php');
                  The file database_connect.php contains the database connection information. But how do I make a connection with a database that I have created using the cpanel??


                  Any help on this would be appreciated.

                  Kinnie

                  Comment


                  • #10
                    Re: Link form to another webpage

                    Hello!

                    The comments script seems to work, however I receive the following error after submitting the data:

                    Warning: Cannot modify header information - headers already sent by (output started at /home2/gybrtdx/public_html/test.php:10) in /home2/gybrtdx/public_html/test.php on line 48


                    I first have created a database called "gybrtdx_Comments" using the cpanel. The php connection string for this database is:
                    $dbh=mysql_connect ("localhost", "gybrtdx_Kinnie", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
                    mysql_select_db ("gybrtdx_Comments");


                    Then I created a table of 10 fields in this database (again using the cpanel), exactly the same fields as the ones that are normally created by the first part of the script.

                    In BlueVoda, I have opened a new blank page and entered the following script in the HTML editor:

                    <?php
                    $dbh=mysql_connect ("localhost", "gybrtdx_Kinnie", "password") or die ('I cannot connect to the database because: ' . mysql_error());
                    mysql_select_db ("gybrtdx_Comments");
                    //query comments for this page of this article
                    $inf = "SELECT * FROM `comments` WHERE page = '".stripslashes($_SERVER['REQUEST_URI'])."' ORDER BY time ASC";
                    $info = mysql_query($inf);
                    if(!$info) die(mysql_error());
                    $info_rows = mysql_num_rows($info);
                    if($info_rows > 0) {
                    echo '<h5>Comments:</h5>';
                    echo '<table width="95%">';

                    while($info2 = mysql_fetch_object($info)) {
                    echo '<tr>';
                    echo '<td>"'.htmlspecialchars(stripslashes($info2->subject)).'" by: <a href="'.$info2->contact.'">'.htmlspecialchars(stripslashes($inf o2->username)).'</a></td> <td><div align="right"> @ '.date('h:i:s a', $info2->time).' on '.$info2->date.'</div></td>';
                    echo '</tr><tr>';
                    echo '<td colspan="2"> '.htmlspecialchars(stripslashes(nl2br($info2->comment))).' </td>';
                    echo '</tr>';
                    }//end while
                    echo '</table>';
                    echo '<hr width="95%" noshade>';
                    } else echo 'No comments for this page. Feel free to be the first <br>';
                    if(isset($_POST['submit'])) {
                    if(!addslashes($_POST['username'])) die('<u>ERROR:</u> you must enter a username to add a comment.');
                    if(!addslashes($_POST['contact'])) die('<u>ERROR:</u> enter contact method in contact field.');
                    if(!addslashes($_POST['subject'])) die('<u>ERROR:</u> enter a subject to your comment.');
                    if(!addslashes($_POST['comment'])) die('<u>ERROR:</u> cannot add comment if you do not enter one!?');
                    //add comment
                    $q ="INSERT INTO `comments` (article_id, page, date, time, username, ip, contact, subject, comment) VALUES ('".$_GET['id']."', '".$_POST['page']."', '".$_POST['date']."', '".$_POST['time']."', '".addslashes($_POST['username'])."', '".$_SERVER['REMOTE_ADDR']."', '".addslashes($_POST['contact'])."', '".addslashes($_POST['subject'])."', '".addslashes($_POST['comment'])."')";
                    $q2 = mysql_query($q);
                    if(!$q2) die(mysql_error());
                    //refresh page so they can see new comment
                    header('Location: http://' . $_SERVER['HTTP_HOST'] . $_POST['page'] . "#commentsrn");
                    } else { //display form
                    ?>
                    <form name="comments" action="<? $_SERVER['PHP_SELF']; ?>" method="post">
                    <input type="hidden" name="page" value="<? echo($_SERVER['REQUEST_URI']); ?>">
                    <input type="hidden" name="date" value="<? echo(date("F j, Y.")); ?>">
                    <input type="hidden" name="time" value="<? echo(time()); ?>">
                    <table width="90%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                    <td><div align="right">Username: </div></td>
                    <td><input name="username" type="text" size="30" value=""></td>
                    </tr>
                    <tr>
                    <td><div align="right">Contact: </div></td>
                    <td><input type="text" name="contact" size="30" value=""> <i>(email or url)</i></td>
                    </tr>
                    <td><div align="right">Subject: </div></td>
                    <td><input type="text" name="subject" size="30" value=""></td>
                    </tr>
                    <tr>
                    <td><div align="right">Comment: </div></td>
                    <td><textarea name="comment" cols="45" rows="5" wrap="VIRTUAL"></textarea></td>
                    </tr>
                    <tr>
                    <td></td>
                    <td colspan="2"><input type="reset" value="Reset Fields">
                    <input type="submit" name="submit" value="Add Comment"></td>
                    </tr>
                    </table>
                    </form>
                    <?
                    } // end else
                    ?>

                    After this, I changed the page properties to php extension and after saving I published the page. The comment form is visible and the submission validation also seems to werk properly. However, after submitting the data the above-mentioned error appears. After refreshing the page both the comment, the name of the visitor and date and time are shown correctly... Any idea what might cause the error message and how I can solve it?

                    Thanks!

                    Kinnie

                    Comment


                    • #11
                      Re: Link form to another webpage

                      Ok, it looks like that I have forgotten to enter the URL of the page that holds the comments form. However, the error message still appears after submitting the data (and the posted message is visible after refreshing the page, but the form is not)...

                      Comment


                      • #12
                        Re: Link form to another webpage

                        Kinnie,
                        I am afraid that what you are attempting- I have never done and therefore will be of little assistance.

                        Is there a reason you chose this more complicated method rather than simply using the one in Fantastico? Just curious.

                        Andy
                        PHP- is a blast!

                        Comment


                        • #13
                          Re: Link form to another webpage

                          Andy,

                          As I posted earlier I would like to create a page about various trips I have made. I was thinking of a home page with a link to each of these trips. After following one of these links, the visitor will be redirected to a page that contains links to each travel day (day 1, day2,...). Each of these pages will contain a short travel story, a route map, some images, and comments that have been posted by visitors. Because these comments often refer to pictures or a quote in the travel story , I thought it would be more convenient to use a form instead of a guestbook...
                          But in the meanwhile I got the script running! (with a little help from my friends) :)

                          Comment


                          • #14
                            Re: Link form to another webpage

                            Kinnie,

                            I think that would be great. I was however thinking that you would not always be able to ftp your daily web updates and alter pages and post pictures and so on. Thats why I suggested a guest book where you could log in from any computer and update your journey and have people join in or lock everyone else out and only have your input- similar to a blog.

                            If you will have access to a computer and will want to alter the web pages each day- then that could be accomplished via a laptop and an internet connection via BV. Or if you figure out the form thing- let me know.

                            I hope I understood that ok.

                            Andy
                            PS- glad you got the script working.
                            PHP- is a blast!

                            Comment

                            Working...
                            X