now what

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mankolele
    New Member
    • Sep 2006
    • 63

    now what

    I used the same code to register onother user officer works fine but the supplier does not work I does says they r registered but when I log in it says the user does not exist.I've looked since monday I give up anyidea what's wrong?????
    php script

    <?php

    // Connects to your Database
    mysql_connect(" localhost", "root", "phpmysql") or die(mysql_error ());
    mysql_select_db ("procdumy") or die(mysql_error ());

    //This code runs if the form has been submitted
    if (isset($_POST['submit'])) {

    //This makes sure they did not leave any fields blank
    if ( !$_POST['username'] | !$_POST['password']|!$_POST['name'] |!$_POST['surname'] |!$_POST['company'] |!$_POST['tele'] |
    !$_POST['fax'] |!$_POST['SuppName'] | !$_POST['bus_addr']|!$_POST['type'] |!$_POST['descr'] |!$_POST['cnt_person'] |
    !$_POST['email'] | !$_POST['reg_no']| !$_POST['vat_no']) {
    header("Locatio n: regFail1.html") ;
    //die('You did not complete all of the required fields<a href=addSupp.ht ml>BACK</a>');
    }
    // checks if the username is in use
    if (!get_magic_quo tes_gpc()) {
    $_POST['username'] = addslashes($_PO ST['username']);
    }
    $usercheck = $_POST['username'];
    $check = mysql_query("SE LECT username FROM users WHERE username = '$usercheck'")
    or die(mysql_error ());
    $check2 = mysql_num_rows( $check);
    //if the name exists it gives an error
    if ($check2 != 0) {
    die('Sorry, the username '.$_POST['username'].' is already in use.<a href=addSupp.ht ml>BACK</a>');
    }
    $_POST['password'] = md5($_POST['password']);
    if (!get_magic_quo tes_gpc()) {
    $_POST['password'] = addslashes($_PO ST['password']);
    $_POST['username'] = addslashes($_PO ST['username']);
    }
    $insert = "INSERT INTO users (username,passw ord,status,name ,surname,compan y,tele,fax,Supp Name,bussAddr,t ype,desciption, cnt_person,emai l,regNum,vatNum )
    VALUES ('".$_POST['username']."', '".$_POST['password']."', '".$_POST['status']."', '".$_POST['name']."', '".$_POST['surname']."',
    '".$_POST['company']."', '".$_POST['tele']."', '".$_POST['fax'].",'".$_POST['SuppName']."', '".$_POST['bus_addr']."',
    '".$_POST['type']."', '".$_POST['descr']."',
    '".$_POST['cnt_person']."', '".$_POST['email']."', '".$_POST['reg_no']."', '".$_POST['vat_no']."')";
    //$add_member = mysql_query($in sert);

    header("Locatio n: regSuccess.html ");
    ?>

    <?php
    }
    ?>

    <?php

    HTML Script::::

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Procurem ent Tracking System</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <form action="adSuppl ier.php" method="post">
    <table width="100%" border="0">
    <tr>
    <td><img src="../Procurement/procurement.JPG "></td>
    </tr>
    </table>

    <hr color="#000000" >
    <strong><font size="6">Regist er New Supplier</font></strong>
    <p></p>
    <div align="center">
    <table width="544" border="1" bordercolor="#0 00000" bgcolor="#A6A65 3" class="text">




    <table width="544" border="1" bordercolor="#0 00000" bgcolor="#A6A65 3" class="text">

    <tr>
    <td colspan="2"><st rong>FILL IN ALL DETAILS</strong></td>
    </tr>
    <tr>
    <td width="183" valign="top" ><font face="Verdana" size="2">Userna me:</font></td>

    <td width="345"><in put type="text" name="username" maxlength="60"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Passwo rd:</font></td>

    <td valign="top"><i nput type="password" name="password" maxlength="60"> </strong></td>
    </tr>
    <tr>
    <td height="20" valign="top"><s trong><font face="Verdana" size="2">Status :
    1=Supplier</font></strong></td>

    <td valign="top"><s trong><input type="text" name="status" maxlength="60"> </strong></td>
    </tr><strong>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Name:</font></td>

    <td valign="top"><i nput type="text" name="name" maxlength="60"> </td>
    </tr>

    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Surnam e:</font></td>

    <td valign="top"><i nput type="text" name="surname" maxlength="10"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Compan y::</font></td>

    <td valign="top"><i nput type="text" name="company" maxlength="10"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Teleph one Number::</font></td>

    <td valign="top"><i nput type="text" name="tele" maxlength="10"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Fax Number::</font></td>

    <td valign="top"><i nput type="text" name="fax" maxlength="10"> </td>
    </tr>


    </strong>


    <tr>
    <td height="20" valign="top"><s trong><font face="Verdana" size="2">Suppli er
    Name :</font></strong></td>

    <td valign="top"><s trong><input type="text" name="SuppName" maxlength="60"> </strong></td>
    </tr><strong>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Busine ss Address:</font></td>

    <td valign="top"><t extarea type="text" name="bus_addr" rows="2" cols="16"></textarea></td>
    </tr>

    <td height="20" valign="top"><f ont face="Verdana" size="2">Busine ss Type:</font></td>

    <td valign="top"><i nput type="text" name="type" maxlength="60"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Descri ption:</font></td>

    <td valign="top"><i nput type="text" name="descr" maxlength="60"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Contac t Person:</font></td>

    <td valign="top"><i nput type="text" name="cnt_perso n" maxlength="60"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">E-mail:</font></td>

    <td valign="top"><i nput type="text" name="email" maxlength="60"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Regist ration Number:</font></td>

    <td valign="top"><i nput type="text" name="reg_no" maxlength="60"> </td>
    </tr>
    <tr>
    <td height="20" valign="top"><f ont face="Verdana" size="2">Vat Number:</font></td>

    <td valign="top"><i nput type="text" name="vat_no" maxlength="60"> </td>
    </tr>

    </strong>
    </table>
    <p></p>
    <div align="center">
    <input type="submit" name="submit" value="Add"> &nbsp;&nbsp;
    <input type="Reset" value="Reset" ></div>
    <hr color="#000000" >
    </form>


    </body>
    </html>



    Thanx In advance
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    I hope you made a copy mistake, but you use a bitwise or operator | instead of a logical OR operator || in your IF ($_POST.... ) statement.
    Change these single | to double || or the OR.

    Ronald :cool:

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      And what about the following code:
      [php]<?php

      HTML Script::::[/php]

      Take that out, it is an error and serves no purpose.
      You also update the $_POST array in various places. You should take parameters out of the $_POST array and assign them to variables on which you must perform your updates.
      And please, next time show your code within code or php tags, because 180 lines is very difficult to rread and does not invite anyone to read it carefully.

      Ronald :cool:

      Comment

      Working...