SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with php/mysql example from Kevins book

    Hey y'all, i need some help with that one example that deals with Inserting data into the DAtabase. (the one with isset() and where the form reloads using $PHP_SELF). i copied it word for word on my machine but cannot get it to work. everytime i click the 'add a joke' link, it displays the same page and doesnt show the submission form. all the previous examples work fine, and obviously i dont wanna move on until i get this one to work too!

    thanks people
    below is the code where it is messing up...taken exactly from Kevins book (replaced joke with song) the whole idea here is to show all the songs in the database and then the user being able to insert one of their own by clicking the "add a song" link(echo("<P><a href='$PHP_SELF?addsong=1'> Add a Song!</a></P>")
    this section of code is SUPPOSED to bring up the submission form but it doesnt.
    <?php
    //if the user wants to add a song
    if(isset($addsong)):
    ?>
    <FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
    <p> Type your song name here:
    <TEXTAREA NAME="songnm" ROWS=10 COLS=20 WRAP>
    </TEXTAREA><br>
    <INPUT TYPE=SUBMIT NAME="submitsong" VALUE="SUBMIT">
    </FORM>
    <?php

  2. #2
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    post some codes and try the "PHP" forum. I'm sure you'll get better help there.

    -asT.

  3. #3
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved - please do not cross post.

    Dan

  4. #4
    SitePoint Enthusiast dave_merwin's Avatar
    Join Date
    Apr 2003
    Location
    Eugene, OR
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    your form action shoudl read as follows:
    <? echo $_SERVER['PHP_SELF']; ?>

    Hope that helps.
    Dave Merwin


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •