php - how to sent data in multiple search options -
hi guys coded search php in custom page site , want search job in same page (i don't want send info action page). have problem don't know why not work pleas can 1 tell me what's problem , current one?! give thanks you.
<div class="row-fluid"> <div class="page-header"> <h1>search users: </h1> </div> <center> <h2>find user(s)</h2> <form name="search" method="post" action=""> seach for: <input type="text" name="find" /> <select name="field"> <option value="user_id">user id</option> <option value="username">username</option> <option value="serialnumber">serialnumber</option> <option value="ip_address">ip address</option> </select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="search" class="btn btn-success" style="vertical-align: super;" /> </form> <span><?php echo $error; ?></span> </center> <table class="table table-striped table-bordered table-condensed"> <thead> <tr> <th>id</th> <th>name</th> <th>e-mail</th> <th>ip</th> <th>serialnumber</th> <th>actions</th> </tr> </thead> <?php if (isset($_post['submit'])) { if (empty($_post['find']) || empty($_post['field'])) { $error = "pleas selection options"; } else { $find=$_post['find']; $value=$_post['field']; $sql = "select * login_log '$value' = '$find'"; $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)) { ?> <tbody> <tr class="pending-user"> <td><?php echo $row['user_id']; ?></td> <td><?php echo $row['username']; ?></td> <td><?php echo $row['email']; ?></td> <td><?php echo $row['ip_address']; ?></td> <td><?php echo $row['serialnumber']; ?></td> <td><a href="ban.php?id=<?php echo $row['user_id']; ?>&ip=<?php echo $row['ip_address']; ?>&sn=<?php echo $row['serialnumber']; ?>" class="btn btn-primary">ban user</a></td> </tr> </tbody> <?php } } } ?> </table> </div>
$_post
contain elements form utilize name=
attribute form fields. $_post['submit'] won't exist unless have name="submit"
1 of fields or buttons. var_dump($_post) see values beingness sent form.
change isset($_post['submit'])
isset($_post['search']
see tutorial on how utilize forms.
php
No comments:
Post a Comment