Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Example of an application script

    I've posted another thread but this problem is sort of a different, so no need to bump an old post.

    I'm searching for a script that lets the client submit their companies information to my database, and also one that lets the customer perform a search for companies that fulfill their needs.

    Here is what I have so far, however instead of asking you guys to help me fix it 40 times, I figure if someone had an example of one that works, it would save us both alot of time.

    PHP Code:
    <?
    include ("config.php");

    mysql_select_db("listings");

    mysql_query("INSERT INTO listing (
    ID, FIRST_NAME, LAST_NAME, TITLE, COMPANY, STREET, CITY, STATE, ZIP, EMAIL, URL, PHONE, FAX, SPECIALTY, CERTIFICATIONS, MODALITY, POPULATION, IN_OUT_PATIENT, OTHER_SERVICES, INSURANCE, PASSWORD, LISTING_TYPE, PHOTO_1, PHOTO_2, LOGO, MAP_LINK, CONFIRM )

    VALUES ('','"
    .$_POST['FIRST_NAME']."','".$_POST['LAST_NAME']."'");

        
    $ID =   $_POST['ID'];
        
    $FIRST_NAME $_POST['FIRST_NAME'];
        
    $LAST_NAME =  $_POST['LAST_NAME'];
        
    $TITLE =  $_POST['TITLE'];
        
    $COMPANY =  $_POST['COMPANY'];
        
    $STREET =  $_POST['STREET'];
        
    $CITY =  $_POST['CITY'];
        
    $STATE =  $_POST['STATE'];
        
    $ZIP =  $_POST['ZIP'];
        
    $EMAIL =  $_POST['EMAIL'];
        
    $URL =  $_POST['URL'];
        
    $PHONE =  $_POST['PHONE'];
        
    $FAX =  $_POST['FAX'];
        
    $SPECIALTY =  $_POST['SPECIALTY'];
        
    $CERTIFICATIONS =  $_POST['CERTIFICATIONS'];
        
    $MODALITY =  $_POST['MODALITY'];
        
    $POPULATION =  $_POST['POPULATION'];
        
    $IN_OUT_PATIENT =  $_POST['IN_OUT_PATIENT'];
        
    $OTHER_SERVICES =  $_POST['OTHER_SERVICES'];
        
    $INSURANCE =  $_POST['INSURANCE'];
        
    $PASSWORD =  $_POST['PASSWORD'];
        
    $LISTING_TYPE =  $_POST['LISTING_TYPE'];
        
    $PHOTO_ONE =  $_POST['PHOTOONE'];
        
    $PHOTO_TWO =  $_POST['PHOTOTWO'];
        
    $LOGO =  $_POST['LOGO'];
        
    $MAP_LINK =  $_POST['MAP_LINK'];
        
    $CONFIRM =  $_POST['CONFIRM']; 

    ?>
    <style type="text/css">
    <!--
    .style1 {font-family: Arial, Helvetica, sans-serif}
    -->
    </style>



    <form action="<? echo ($self ); ?>" method="post" enctype="multipart/form-data">
      <div align="right">
        <table width="80%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/Logo.jpeg" longdesc="../images/Logo.jpeg" /></td>
          </tr>
        </table>
        <table width="80%" border="0" cellspacing="4" cellpadding="4">
          <tr>
            <td><div align="right" class="style1">First Name: </div></td>
            <td><input type="text" name="FIRST_NAME" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Last Name: </div></td>
            <td><input name="LAST_NAME" type="text" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Title:</div></td>
            <td><input type="text" name="TITLE" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Company:</div></td>
            <td><input type="text" name="COMPANY" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Street:</div></td>
            <td><input type="text" name="STREET" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">City:</div></td>
            <td><input type="text" name="CITY" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">State:</div></td>
            <td><input type="text" name="STATE" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Zip:</div></td>
            <td><input type="text" name="ZIP" size="6"/></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">EMail:</div></td>
            <td><input type="text" name="EMAIL" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">URL:</div></td>
            <td><input type="text" name="URL" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Phone:</div></td>
            <td><input type="text" name="PHONE" size="15"/></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Fax:</div></td>
            <td><input type="text" name="FAX" size="15" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Specialty:</div></td>
            <td><select name="select" size="1">
              <option selected="selected">Standard</option>
              <option>Premium</option>
              <option>Display Ad</option>
            </select>        </td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Certifications:</div></td>
            <td><input type="text" name="CERTIFICATIONS" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Modality:</div></td>
            <td><input type="text" name="MODALITY" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Population:</div></td>
            <td><input type="text" name="POPULATION" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">In Out Patient: </div></td>
            <td><input type="text" name="IN_OUT_PATIENT" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Other Services: </div></td>
            <td><input type="text" name="OTHER_SERVICES" /></td>
          </tr><br />
          <tr>
            <td><div align="right" class="style1">Insurance:</div></td>
            <td><input type="text" name="INSURANCE" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Password:</div></td>
            <td><input type="text" name="PASSWORD" size="15" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Listing Type: </div></td>
            <td><input type="text" name="LISTING_TYPE" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Photo One: </div></td>
            <td><input type="file" name="file" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Photo Two: </div></td>
            <td><input type="file" name="file2" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Logo:</div></td>
            <td><input type="file" name="file3" /></td>
          </tr>
          <tr>
            <td><div align="right" class="style1">Map Link: </div></td>
            <td><input type="text" name="MAP_LINK" /></td>
          </tr>
        </table>
        <p align="left">
          <input name="submit" type="submit" class="style1" value="Submit" />
          <br />
          <br />
        </p>
        <p align="left">&nbsp;</p>a
      </div>
    </form>

    <div align="left">
     
      <? 


    mysql_query
    ("INSERT INTO listings (

    ID,

    FIRST_NAME,

    LAST_NAME,

    TITLE,

    COMPANY,

    STREET,

    CITY,

    STATE,

    ZIP,

    EMAIL,

    URL,

    PHONE,

    FAX,

    SPECIALTY,

    CERTIFICATIONS,

    MODALITY,

    POPULATION,

    IN_OUT_PATIENT,

    OTHER_SERVICES,

    INSURANCE,

    PASSWORD,

    LISTING_TYPE,

    PHOTOONE,

    PHOTOTWO,

    LOGO,

    MAP_LINK,

    CONFIRM

    )

    VALUES (

    '',

    '"
    .$_POST['ID']."',

    '"
    .$_POST['FIRST_NAME']."',

    '"
    .$_POST['LAST_NAME']."',

    '"
    .$_POST['TITLE']."',

    '"
    .$_POST['COMPANY']."',

    '"
    .$_POST['STREET']."',

    '"
    .$_POST['CITY']."',

    '"
    .$_POST['STATE']."',

    '"
    .$_POST['ZIP']."',

    '"
    .$_POST['EMAIL']."',

    '"
    .$_POST['URL']."',

    '"
    .$_POST['PHONE']."',

    '"
    .$_POST['FAX']."',

    '"
    .$_POST['SPECIALTY']."',

    '"
    .$_POST['CERTIFICATIONS']."',

    '"
    .$_POST['MODALITY']."',

    '"
    .$_POST['POPULATION']."',

    '"
    .$_POST['IN_OUT_PATIENT']."',

    '"
    .$_POST['OTHER_SERVICES']."',

    '"
    .$_POST['INSURANCE']."',

    '"
    .$_POST['PASSWORD']."',

    '"
    .$_POST['LISTING_TYPE']."',

    '"
    .$_POST['PHOTOONE']."',

    '"
    .$_POST['PHOTOTWO']."',

    '"
    .$_POST['LOGO']."',

    '"
    .$_POST['MAP_LINK']."',

    '"
    .$_POST['CONFIRM']."'

    )"
    )or die ("$DatabaseError 48".mysql_error());
    $rs mysql_query($sql); 

    ?>
    Any help is appreciated. Thanks everyone.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    So.... what's wrong with your script? What errors does it give you? etc.etc.


  •  

    Posting Permissions

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