0

i have this form i built using php the form is supposed to search for a user in formation in my database, but when i fill in the search box and click ok it will try to load process.php instead of the search.php i assigned it to redirect to and for that reason it shows me "PAGE NOT FOUND" *** and for the refrence it is a wordpress plugin that i want to use on my website that i am trying to build

this is the code

 add_action( 'admin_menu', 'addAdminMenu' );

function addAdminMenu(){
add_menu_page('ClassifiedBr Settings', 'ClassifiedBr', 'manage_options', 'classifiedbr_settings_page', 'classifiedbr_init', '', 3);
add_submenu_page('classifiedbr_settings_page','Classified Sub', 'Classified Sub','manage_options', 'classified_sub_slug', 'stracking_init');
}

function classifiedbr_init(){
    echo '<form action="demo.php" method="post" />';
    echo "<h1>Britchi Tracking</h1>";
    echo '<p>';
    echo 'Costumers Name (required) <br/>';
    echo '<input type="text" name="cname" placeholder="Emmanuel John"/>';
    echo '</p>';
    echo '<p>';
    echo 'Tracking number (required) <br/>';
    echo '<input type="text" name="ctracking" placeholder="EEX28PDS"/>';
    echo '</p>';
    echo '<p>';
    echo 'Email (required) <br/>';
    echo '<input type="email" name="cemail" placeholder="Email"/>';
    echo '</p>';
    echo '<p>';
    echo 'Recived Port (required) <br/>';
    echo '<input type="text" name="crport" placeholder="Brazil Port"/>';
    echo '</p>';
    echo '<p>';
    echo 'Delivered Port (required) <br/>';
    echo '<input type="text" name="cdport" placeholder="Lagos Port"/>';
    echo '</p>';
    echo '<p>';
    echo 'Current Location (required) <br/>';
    echo '<input type="text" name="clocation" placeholder="Abuja" />';
    echo '</p>';
    echo '<p>';
    echo 'Destination (required) <br/>';
    echo '<input type="text" name="cdestination" placeholder="Total filling Station, Abuja"/>';
    echo '</p>';
    echo '<p><input type="submit" name="cregistered" value="Register"></p>';
    echo '</form>';
}

 function stracking_init(){
    echo '<form action="search.php" method="post" />';
    echo "<h1>Britchi Tracking</h1>";
    echo '<p>';
    echo 'Costumers Name (required) <br/>';
    echo '<input type="text" name="search" placeholder="Emmanuel John"' . '" size="70"/>';
    echo '</p>';
    echo '<p><input type="submit" name="csearch" value="Search"></p>';
    echo '</form>';
}
add_shortcode('TRACSEARCH', 'stracking_init');
?>

in this code I have 2 forms the first one (classifiedbr_init)sending to demo.php and the second one (strackinh_init) sending to search.php

as you can see the classifiedbr_init and the stracking_init functions will show on the admin page but only the stracking_init will show on the the frontend becouse i created a shortcode for it

this is the search.php code

<table border="">
    <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
        <th>RecivedPort</th>
        <th>DestinationPort</th>
        <th>Location</th>
        <th>Destination</th>
    </tr>


<?php
$conn=mysqli_connect("localhost","root","","class");
$set=$_POST['search'];
if($set) {
    $show="SELECT * FROM demo where fname='$set'";
    $result=mysqli_query($conn, $show);
    while($rows=mysqli_fetch_array($result)) {

        echo  "<tr>";
        echo "<td>";
        echo $rows['cname'];
        echo  "</td>";
        echo  "<td>";
        echo $rows['ctracking'];
        echo  "</td>";
        echo  "<td>";
        echo $rows['cemail'];
        echo  "</td>";
        echo "<td>";
        echo $rows['crport'];
        echo  "</td>";
        echo "<td>";
        echo $rows['cdport'];
        echo  "</td>";
        echo "<td>";
        echo $rows['clocation'];
        echo  "</td>";
        echo "<td>";
        echo $rows['cdestination'];
        echo  "</td>";
        echo  "</tr>";
        echo "</br>";

    }
}
else{
    echo "nothing found";
}
?>

</table>

thanks as you help me out

Britchi2
  • 37
  • 1
  • 7

0 Answers0