Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI have a custom database that i succesfully brought into my plugin submenu page and it displays the results great. If you manually add a row to the DB with phpmyadmin it shows that result on a refresh. Here's a screen shot of result page from that database here:-> CODE below:
<table border="1">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Buyer's Email Address</th>
<th>Software Title</th>
<th>IP Address 01</th>
<th>IP Address 02</th>
<th>Payment Status</th>
</tr>
<?php
global $wpdb;
$ipn_tables = $wpdb->prefix ."ipn_data_tbl";
$result = $wpdb->get_results ( "SELECT * FROM $ipn_tables" );
foreach ( $result as $print ) {
?>
<tr>
<td><?php echo $print->first_name;?></td>
<td><?php echo $print->last_name;?></td>
<td><?php echo $print->payer_email;?></td>
<td><?php echo $print->item_name;?></td>
<td><?php echo $print->ip_address_01;?></td>
<td><?php echo $print->ip_address_02;?></td>
<td><?php echo $print->payment_status;?></td>
</tr>
<?php }
?></table>
I pre added a search box but how to search this html table and show results from a search. Have been looking all day and tried the above code repeated twice in two different functions then tried this:
<form>
<form method="post" action="" >
<input type="text" placeholder="Search Transactions.." name="submit">
<input type="submit" class="button-primary" value="Search" name="submit">
<input type="reset" class="button-primary" value="Reset Form">
</form>
<?php
if(isset($_POST['submit']) && !empty($_POST['submit'])) {
// there is something in the field, do stuff
$search = $_POST["search"];
return_esb_searches ();
echo "searching";
} else {
// trigger normal results
all_esb_results ();
echo "showing normal results display without search";
}
In the 'search' function i tried:
$result = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$ipn_tables} WHERE item_name like $search OR first_name like $search OR last_name like $search OR payer_email like $search" ));
Any help would be appreciated.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI have a custom database that i succesfully brought into my plugin submenu page and it displays the results great. If you manually add a row to the DB with phpmyadmin it shows that result on a refresh. Here's a screen shot of result page from that database here:-> http://prntscr/mropc3 CODE below:
<table border="1">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Buyer's Email Address</th>
<th>Software Title</th>
<th>IP Address 01</th>
<th>IP Address 02</th>
<th>Payment Status</th>
</tr>
<?php
global $wpdb;
$ipn_tables = $wpdb->prefix ."ipn_data_tbl";
$result = $wpdb->get_results ( "SELECT * FROM $ipn_tables" );
foreach ( $result as $print ) {
?>
<tr>
<td><?php echo $print->first_name;?></td>
<td><?php echo $print->last_name;?></td>
<td><?php echo $print->payer_email;?></td>
<td><?php echo $print->item_name;?></td>
<td><?php echo $print->ip_address_01;?></td>
<td><?php echo $print->ip_address_02;?></td>
<td><?php echo $print->payment_status;?></td>
</tr>
<?php }
?></table>
I pre added a search box but how to search this html table and show results from a search. Have been looking all day and tried the above code repeated twice in two different functions then tried this:
<form>
<form method="post" action="" >
<input type="text" placeholder="Search Transactions.." name="submit">
<input type="submit" class="button-primary" value="Search" name="submit">
<input type="reset" class="button-primary" value="Reset Form">
</form>
<?php
if(isset($_POST['submit']) && !empty($_POST['submit'])) {
// there is something in the field, do stuff
$search = $_POST["search"];
return_esb_searches ();
echo "searching";
} else {
// trigger normal results
all_esb_results ();
echo "showing normal results display without search";
}
In the 'search' function i tried:
$result = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$ipn_tables} WHERE item_name like $search OR first_name like $search OR last_name like $search OR payer_email like $search" ));
Any help would be appreciated.
<form>
<form method="post" action="" >
<input type="text" placeholder="Search Transactions.." name="submit">
<input type="submit" class="button-primary" value="Search" name="submit">
<input type="reset" class="button-primary" value="Reset Form">
</form>
should be
<form method="post" action="" >
<input type="text" placeholder="Search Transactions.." name="search">
<input type="submit" class="button-primary" value="Search" name="submit">
<input type="reset" class="button-primary" value="Reset Form">
</form>
i.e. Remove extra start tag <form>
and for text field name="submit"
should be name="search"
I hope this will work!