Php Help

Discussion in 'Gaming' started by AndrewR., Sep 22, 2005.

  1. AndrewR.

    AndrewR. Well-Known Member

    Age:
    32
    Posts:
    1,831
    Likes Received:
    0
    Joined:
    Aug 6, 2005
    Location:
    Scottsdale, Arizona
    Ok, here is the code:

    Code:
    <?php include("dbconnect.php") ?>
    <?php
    
    if(isset($_POST['submit'])) {
    
    $gunname=$_POST['gunname'];
    
    $gunmodel=$_POST['gunmodel'];
    
    $gunmanufacturer=$_POST['gunmanufacturer'];
    
    $gunscale=$_POST['gunscale'];
    
    $powertype=$_POST['powertype'];
    
    $caliber=$_POST['caliber'];
    
    $length=$_POST['length'];
    
    $feetpersecond=$_POST['feetpersecond'];
    
    $clipcapacity=$_POST['clipcapacity'];
    
    $material=$_POST['material'];
    
    $weight=$_POST['weight'];
    
    $includes=$_POST['includes'];
    
    $warranty=$_POST['warranty'];
    
    $price=$_POST['price'];
    
    $shortdescription=$_POST['shortdescription'];
    
    $buylink=$_POST['buylink'];
    
    if(select=="1") {
    $sql = mysql_query("INSERT INTO `pistols` ( `gunname` , `gunmodel` , `gunmanufacturer`, `gunscale`, `powertype`, `caliber`, `length`, `feetpersecond`, `clipcapacity`, `material`, `weight`, `includes`, `warranty`, `price`, `shortdescription`, `buylink` ) VALUES ('$gunname', '$gunmodel', '$gunmanufacturer', '$gunscale', '$powertype', '$caliber', '$length', '$feetpersecond', '$clipcapacity', '$material', '$weight', '$includes', '$warranty', '$price', '$shortdescription', '$buylink');");
    
    echo 'Thank you for your new submission!';
    
    }
    
    ?>
    <form method="post" action="submit.php">
    <table width="52%" height="459" border="0">
    <tr>
    <td valign="top">Gun Name </td>
    <td valign="top"> <input type="text" name="gunname" size="25">
    </td>
    </tr>
    <tr>
    <td valign="top">Gun Model </td>
    <td valign="top"> <input name="gunmodel" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Gun Manufacturer </td>
    <td valign="top"> <input name="gunmanufacturer" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Gun Scale 
    </td>
    <td valign="top"> <textarea name="gunscale" size="25"></textarea>
    </td>
    </tr>
    <tr>
    <td height="85" valign="top">Power Type 
    </td>
    <td valign="top"> <textarea name="powertype" size="25"></textarea>
    </td>
    </tr>
    <tr>
    <td valign="top">Caliber </td>
    <td valign="top"> <input name="caliber" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Length </td>
    <td valign="top"> <input name="length" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Feet Per Second [FPS/Velocity] </td>
    <td valign="top"> <input name="feetpersecond" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Clip Capacity </td>
    <td valign="top"> <input name="clipcapacity" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Material </td>
    <td valign="top"> <input name="material" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Weight </td>
    <td valign="top"> <input name="weight" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Includes </td>
    <td valign="top"> <input name="includes" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Warranty </td>
    <td valign="top"> <input name="warranty" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Price </td>
    <td valign="top"> <input name="price" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Short Description </td>
    <td valign="top"> <input name="shortdescription" type="text" size="100"> </td>
    </tr>
    <tr>
    <td valign="top">Buy Link </td>
    <td valign="top"> <input name="buylink" type="text" size="25"> </td>
    </tr>
    <tr>
    <td height="85" valign="top">Caliber 
    </td>
    <td valign="top"> <textarea name="caliber" size="25"></textarea>
    </td>
    </tr>
    <tr>
    <td height="25" valign="top"></td>
    <td valign="top"><input type="submit" name="submit" value="Submit New Model!"></td>
    </tr>
    </form>
    </table>
    And here is the error:
    Code:
    Parse error: parse error, unexpected $ in /home/eastmans/public_html/Pistols/submit.php on line 125
    I know that that error means there is a mistake with my script but me nor some other people can't find the mistake. [Line 125 is the last line, BTW]

    Please Help!
     
  2. XxLostXx

    XxLostXx Well-Known Member

    Age:
    32
    Posts:
    803
    Likes Received:
    0
    Joined:
    Aug 22, 2005
    Location:
    homeless
  3. BrokenFaith

    BrokenFaith Well-Known Member

    Posts:
    2,380
    Likes Received:
    0
    Joined:
    Sep 1, 2005
    hmm seems logical eh?
     
  4. AndrewR.

    AndrewR. Well-Known Member

    Age:
    32
    Posts:
    1,831
    Likes Received:
    0
    Joined:
    Aug 6, 2005
    Location:
    Scottsdale, Arizona
    Well, it works when I save it as a .HTML file but then it won't actually work, I need it as a .PHP file but when I put it as that, I get the error, any ideas?
     
  5. BrokenFaith

    BrokenFaith Well-Known Member

    Posts:
    2,380
    Likes Received:
    0
    Joined:
    Sep 1, 2005
    wow this script is really beign gay, you need like somsone to help you , i wish i could, i dont know PHP for anythign, ANyone else tho help him!
     
  6. Dappem

    Dappem Well-Known Member

    Posts:
    232
    Likes Received:
    0
    Joined:
    Aug 15, 2004
    did you write the script yourself ???
     
  7. XxLostXx

    XxLostXx Well-Known Member

    Age:
    32
    Posts:
    803
    Likes Received:
    0
    Joined:
    Aug 22, 2005
    Location:
    homeless
    I have no clue what's wrong but it's on line 124:
    Parse error: parse error, unexpected $ in /home/blink/public_html/apply/test.php on line 124

    That's what I get but when you remove the second <?php just below the include it works. But then you have to give an exact path to 'dbconnect.php'
     
  8. Daz

    Daz Well-Known Member

    Age:
    36
    Posts:
    1,024
    Likes Received:
    0
    Joined:
    Nov 5, 2004
    Location:
    UK
    you forgot to put one of the braces in at the end, before u closed the php, and hense why it was having parshing errors.
    below should work, if not just add the extra }
    :P Daz

    Code:
    <?php
    
    include("dbconnect.php");
    
    if(isset($_POST['submit'])) {
    
    $gunname=$_POST['gunname'];
    
    $gunmodel=$_POST['gunmodel'];
    
    $gunmanufacturer=$_POST['gunmanufacturer'];
    
    $gunscale=$_POST['gunscale'];
    
    $powertype=$_POST['powertype'];
    
    $caliber=$_POST['caliber'];
    
    $length=$_POST['length'];
    
    $feetpersecond=$_POST['feetpersecond'];
    
    $clipcapacity=$_POST['clipcapacity'];
    
    $material=$_POST['material'];
    
    $weight=$_POST['weight'];
    
    $includes=$_POST['includes'];
    
    $warranty=$_POST['warranty'];
    
    $price=$_POST['price'];
    
    $shortdescription=$_POST['shortdescription'];
    
    $buylink=$_POST['buylink'];
    
    if(select=="1") {
    $sql = mysql_query("INSERT INTO `pistols` ( `gunname` , `gunmodel` , `gunmanufacturer`, `gunscale`, `powertype`, `caliber`, `length`, `feetpersecond`, `clipcapacity`, `material`, `weight`, `includes`, `warranty`, `price`, `shortdescription`, `buylink` ) VALUES ('$gunname', '$gunmodel', '$gunmanufacturer', '$gunscale', '$powertype', '$caliber', '$length', '$feetpersecond', '$clipcapacity', '$material', '$weight', '$includes', '$warranty', '$price', '$shortdescription', '$buylink');");
    
    echo 'Thank you for your new submission!';
    
    }
    }
    ?>
    <form method="post" action="submit.php">
    <table width="52%" height="459" border="0">
    <tr>
    <td valign="top">Gun Name </td>
    <td valign="top"> <input type="text" name="gunname" size="25">
    </td>
    </tr>
    <tr>
    <td valign="top">Gun Model </td>
    <td valign="top"> <input name="gunmodel" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Gun Manufacturer </td>
    <td valign="top"> <input name="gunmanufacturer" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Gun Scale 
    </td>
    <td valign="top"> <textarea name="gunscale" size="25"></textarea>
    </td>
    </tr>
    <tr>
    <td height="85" valign="top">Power Type 
    </td>
    <td valign="top"> <textarea name="powertype" size="25"></textarea>
    </td>
    </tr>
    <tr>
    <td valign="top">Caliber </td>
    <td valign="top"> <input name="caliber" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Length </td>
    <td valign="top"> <input name="length" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Feet Per Second [FPS/Velocity] </td>
    <td valign="top"> <input name="feetpersecond" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Clip Capacity </td>
    <td valign="top"> <input name="clipcapacity" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Material </td>
    <td valign="top"> <input name="material" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Weight </td>
    <td valign="top"> <input name="weight" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Includes </td>
    <td valign="top"> <input name="includes" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Warranty </td>
    <td valign="top"> <input name="warranty" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Price </td>
    <td valign="top"> <input name="price" type="text" size="25"> </td>
    </tr>
    <tr>
    <td valign="top">Short Description </td>
    <td valign="top"> <input name="shortdescription" type="text" size="100"> </td>
    </tr>
    <tr>
    <td valign="top">Buy Link </td>
    <td valign="top"> <input name="buylink" type="text" size="25"> </td>
    </tr>
    <tr>
    <td height="85" valign="top">Caliber 
    </td>
    <td valign="top"> <textarea name="caliber" size="25"></textarea>
    </td>
    </tr>
    <tr>
    <td height="25" valign="top"></td>
    <td valign="top"><input type="submit" name="submit" value="Submit New Model!"></td>
    </tr>
    </form>
    </table>
     

Share This Page