Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3976804
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:50:54+00:00 2026-05-20T04:50:54+00:00

First let’s explain what I want to do and then ask my question! Well,

  • 0

First let’s explain what I want to do and then ask my question!
Well, I want to use a search filter for a query (the user should choose by which field will search the database, eg by name, code or fname) After the query runs, I want to show the data in some textfields, so the user can change them.

To do this, I put the first part (search filter-radio group- and filter value-text field-) in my first page(getStudentFilter.php). On submit, the query runs, I put values in SESSION and opens the second page(change_user.php) with my correct data!
If user change student’s data, the update in db is ok, but in page change_user.php it shows the initial data again.

I tried to change SESSION values so I can keep my new values before run the update query, but it seems wrong.

Can someone give me a solution so I can fix the problem? Can this be done as it is or I have to change it and put both queries (select and update) in one form? Aaahh, I tried to put both in one form but I don’t know how to control two “submit” in one form…

Thanks in advance..

my code after changes is

<form name="change_student" method="post" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" >
<?php
    if ( isset($_POST['upd_student']) && $_POST['upd_student'] = 'Change' ){
        echo "UPDATE";
        //RUN UPDATE QUERY

    }
    elseif( isset($_POST['get_filter']) && $_POST['get_filter'] == 'Show' ){
        echo "SELECT";
        $query = "select * from student where ".$_POST['filter']."='".$_POST['filter_val']."'";
            $result = mysql_query($query);
            $row = mysql_fetch_array($result);

            $id = $row['idstudent'];
        $fn = $row['fname'];
        $ln = $row['lname'];
        $ph = $row['phone'];
        $sc = $row['school_dept'];
        echo "<META HTTP-EQUIV='Refresh' CONTENT='0' >";
    }
?>                                                      
<table width="310">
  <tr><td><label><b>FILTER</b></label></td> </tr>
  <tr><td><label><input type="radio" name="filter" value="idstudent" id="filter_5">ID </label></td></tr>
  <tr><td><label><input type="radio" name="filter" value="fname" id="filter_3">FIRST NAME</label></td></tr>
  <tr><td><label><input type="radio" name="filter" value="lname" id="filter_4">LAST NAME</label></td></tr>
  <tr><td><input type="text" name="filter_val"> </td></tr>
  <tr><td><input type="submit" name="get_filter" id="get_filter" value="Show"></td></tr>
</table>


    <table>
       <th colspan="2">STUDENT'S DATA</th>
        <tr><td>ID</td><td><input type="text" name="st_id" value="<?php echo $id?>"></td></tr>
        <tr><td>FIRST NAME</td><td><input type="text" name="fname" value="<?php echo $fn?>"></td></tr>
        <tr><td>LAST NAME</td><td><input type="text" name="lname" value="<?php echo $ln?>"></td></tr>
        <tr><td>PHONE</td><td><input type="text" name="phone" value="<?php echo $ph?>"></td></tr>
        <tr><td>DEPT</td><td><input type="text" name="dept" value="<?php echo $sc?>"></td></tr>
    </table>
    <input type="submit" name="upd_student" value="Change">

</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:50:55+00:00Added an answer on May 20, 2026 at 4:50 am

    To control 2 submits in one form you would have to test the values in you’re php script .

    Let’s take the following html form:

    <form  action="index.php" name="contestForm" id="contestForm" method="POST">
        <input type="submit" value="Select" name="select" />
        <input type="submit" value="Update" name="update" />
    </form>
    

    Now in you’re php script you would do this :

    if ( isset($_POST['update']) && $_POST['update'] = 'Update' )
    {
        //do the update part
        echo "UPDATE";
    } elseif ( isset($_POST['select']) && $_POST['select'] == 'Select' )
    {
        //do the select part
        echo "SELECT";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First let me explain that I have this script that should let users enter
First let me explain what I don't mean. I don't want to type an
First let me explain why I am asking this question so its clear that
First let me explain how I currently handle validation, say, for an IPv4 address:
First let me tell you what I want to achieve. I want a layout
First let me explain. I have several addresses on the page that I put
First let me explain that I've created a million lib directories scouring out all
First let me say that I know it's better to use the subprocess module,
I'm writing a program for iPhone that will first let the user take a
I seem to be having trouble with Threading. First let me explain how the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.