SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2011
    0 Post(s)
    0 Thread(s)

    Form submit issue in characters but digits r OK (mysql DB)

    Hello There,

    Actually i am in front of an issue i think it's very small and i need you to support me for.
    When i submit form below

    Code HTML4Strict:
    <form action="network.php" method="GET" class="form">
          <div style="width:300px;" class="form">Branch id:<br>
            <input id="branchid" type="text" name="branchid"><br><br>
    	<input type="submit" VALUE="SUBMIT" class="form">

    it's connects to mysql DB for table tblbranch as below structure

    Code MySQL:
    CREATE TABLE tblbranch (
      id int(11) NOT NULL AUTO_INCREMENT,
      BranchNo varchar(255) NOT NULL,
      BranchName varchar(255) NOT NULL,
      BranchType varchar(255) NOT NULL,
      BusinessOwner varchar(255) NOT NULL,
      Region varchar(255) NOT NULL,
      Diagram varchar(255) NOT NULL,
      PRIMARY KEY (id)

    Here is my result for this query.

    Code PHP:
    $query="SELECT * FROM tblbranch where BranchNo=$_GET['branchid']  LIMIT 1";
    while ($catagory=mysql_fetch_array($result)) {
    if (isset($_GET['branchid']))  {   
        {    echo "<table class=\"details\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"branch\">Branch id:</td><td class=\"branchid\">(".$catagory['BranchNo'].")</td></tr><tr><td>Name:</td><td>".$catagory['BranchName']."</td></tr>
    <tr><td>Region:</td><td>".$catagory['Region']."</td></tr><tr><td>Diagram:</td><td><a href='".$catagory['Diagram']."' target='_blank'>Diagram</td></tr><tr><td>Branch Type</td><td>".$catagory['BranchType']."</td></tr>";} 
    else {  echo "test";}

    It's really works fine in one situation which is when branchid=(digit1234567890)

    But when it comes to characters letters A-Z.

    it shows nothing

    Please support me for this issue.

    Also, how i can make else if the $_GET['branchid'] is not exist in branchno column it would shows branch id is not exist.

    Thank you so much guys.

  2. #2
    Join Date
    Apr 2011
    no fixed address
    0 Post(s)
    0 Thread(s)
    You have BranchNo defined as a varchar in your table, so its value needs to be enclosed in quotes in your sql query.


Posting Permissions

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