A Bug I Can't Find

Discussion in 'PHP' started by !Unreal, Aug 5, 2008.

  1. #1
    There is a bug in the script I have just made but I can't find the problem.

    I only started learning PHP a little while ago, so treat me like a newbie ;)

    For some reason my script won't parse, it says that there is an error with line 14 but this is just HTML and there are no errors that I can see.

    Here is what shows up: Link

    My script:
    
    <?php
    //////////////////////////////////////////
    //// MySQL Database Connection ///////////
    //////////////////////////////////////////
    $host = "localhost";
    $user = "theflick_divx";
    $db_name= "theflick_divx";
    $pass= "password";
    
    $conn = mysql_connect($host, $user, $pass) or die(mysql_error());
    mysql_select_db($db_name, $conn) or die(mysql_error());
    
    //DivX Table
    <table width="482" height="120" border="0" align="center">
      <tr>
        <td width="476" height="21">DivX: </td>
      </tr>
      <tr>
        <td><form id="form1" name="form1" method="post" action="">
            <label>
              Movie Name: <input name="$moviename" type="text" size="31" maxlength="30" />
            </label>
            <br />
            <label>
              Divx Link :
              <input name="$divxlink" type="text" size="34" maxlength="1000" />
            </label>   
            <br />
            <label>
              IMDB Link:    
              <input name="$imdblink" type="text" size="33" maxlength="50" />
            </label>
            <br />
            <label>
              Image URL:    
              <input name="$imageurl" type="text" id="$imageurl" size="33" maxlength="100" />
            </label> 
                    <br />
            <label>
              Optional Backlink:    
              <input name="$backlink" type="text" size="27" maxlength="100" />
            </label>       
          </form>
        </td>
      </tr>
    </table>
    
    INSERT INTO links (moviename, divxurl, imdb, imageurl, backlink) VALUES ('$moviename', '$divxlink', '$imdblink', '$imageurl', '$backlink');
    ?>
    PHP:
    Please help me :eek:
     
    !Unreal, Aug 5, 2008 IP
  2. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you have not echoed your variables in your html u have

    <input name="$imageurl" type="text" id="$imageurl" size="33" maxlength="100" />
    Code (markup):
    this should be

    echo "<input name=\"".$imageurl."\" type=\"text\" id=\"".$imageurl."\" size=\"33\" maxlength=\"100\" />";
           
    PHP:
    you need to do this or sum thing Sim to your html code
     
    cornetofreak, Aug 5, 2008 IP
    !Unreal likes this.
  3. !Unreal

    !Unreal Well-Known Member

    Messages:
    1,671
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    165
    #3
    Oh. I didn't know that. Thank you. :)
     
    !Unreal, Aug 5, 2008 IP
  4. !Unreal

    !Unreal Well-Known Member

    Messages:
    1,671
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    165
    #4
    Yay! That error is fixed now.

    But now we have another one...

    I think this code is in the wrong place

    INSERT INTO links (moviename, divxurl, imdb, imageurl, backlink) VALUES ('$moviename', '$divxlink', '$imdblink', '$imageurl', '$backlink');
    PHP:
    Where should it go?
     
    !Unreal, Aug 5, 2008 IP
  5. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    lol you need to use mysql_query(INSERT... goes here);

    look it up on http://www.php.net
     
    cornetofreak, Aug 5, 2008 IP
  6. !Unreal

    !Unreal Well-Known Member

    Messages:
    1,671
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    165
    #6
    Oh, like I say. Im a newbie ;)
     
    !Unreal, Aug 5, 2008 IP