www.webdeveloper.com
Results 1 to 3 of 3

Thread: i was strucked here

Hybrid View

  1. #1
    Join Date
    Nov 2012
    Posts
    20

    i was strucked here

    hi Friends....

    i am trying to retrieve data from table by using check box values. but while running that program am getting tese following errors please let me know where i did the mistake!!!!!!
    here is my code
    <html>
    <?php
    if(isset($_POST["refine1"]))
    {
    $hyd=$_POST["hyd"];
    $bnglr=$_POST["bnglr"];
    $chni=$_POST["chni"];
    $pne=$_POST["pne"];
    $mbi=$_POST["mbi"];
    $dli=$_POST["dli"];
    $j=1;
    $sql="select * from jobs where location=$hyd OR location=$bnglr OR location=$chni OR location=$pne OR location=$mbi OR location=$dli";
    mysql_select_db("goget");
    $rtvl=mysql_query($sql);
    echo "<form method='post'><table width='600px'>";
    while ($row=mysql_fetch_array($rtvl))
    {
    echo "<tr><td><input type='checkbox' name='r".$j."' value='$row[1]'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a href='just.php?id=".$row[2]."' style='color:blue' name='".$j."' target='_blank'>".$row['jobtitle']."</a>".$row['date']."</td></tr><tr><td>".$row['companyname']."</td></tr>
    <tr><td>".$row['jobdiscription']."</td></tr><tr><td></td></tr><tr><td></td></tr>";
    $j++;
    }

    echo "</table></form>";
    }
    ?>
    <body>
    <form method="post"><table>
    <tr><td><b>Location</b></td></tr>
    <tr><td><input type="checkbox" name="hyd" value="hyderabad"/>Hyderabad</td></tr>
    <tr><td><input type="checkbox" name="bnglr" value="bangalore"/>Bangalore</td></tr>
    <tr><td><input type="checkbox" name="chni" value="chennai"/>Chennai</td></tr>
    <tr><td><input type="checkbox" name="pne" value="pune"/>Pune</td></tr>
    <tr><td><input type="checkbox" name="mbi" value="mumbai"/>Mumbai</td></tr>
    <tr><td><input type="checkbox" name="dli" value="delhi"/>Delhi</td></tr>
    <tr><td align="center"><input type="submit" name="refine1" value="Refine" /></td></tr>
    </table></form>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2009
    Posts
    452
    your question is not clear.
    try error_reporting(E_ALL); and mysql_error(); to find out the errors that may occur

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,244
    Please use this forum's [php]...[/php] bbcode tags around your code samples.

    If any/all of those values are strings, their variables will need to be single-quoted within your SQL.

    Note that your code is open to SQL injection attacks/errors due to those inputs not being escaped. Better yet: use the more up-to-date MySQLi or PDO extension with prepared statements and bound parameters in order to automatically handle input escaping where needed.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles