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 7894333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:22:08+00:00 2026-06-03T07:22:08+00:00

in this code i didnt find solution how to let table1 with data .

  • 0

in this code i didnt find solution how to let table1 with data . when table2 displayed after refresh table1`s data disapeared !! how can i fix this ?

         <?php
$menucompare="";
if (isset($_POST["menucompare"]))
{
 $menucompare= $_POST['menucompare'];
 $table1 = '
                        <table id= "Table1" width="100%" border="1" cellspacing="0" cellpadding="0">
                                        <!--SW - You need a tr tag around these headers-->
                                        <th >Weeks</th>
                                        <th ><p></p></th>
                                        <th > More Details</th>


                                        <tr id="tr">

                                                <tr id= "tr " >
                                                   <td  >gggg</td>
                                                   <td >kkkkk</td>
                                                   <td >
                                                                        <form name ="dets" method="POST" action="">
                                                                                <input class = "showt" name ="wnumber" id ="wnumber" type="submit" value= "More Details" />
                                                                                <input type="hidden" name="data" value="wnumber" />

                                                                                   <noscript>
                                                                                <input type="submit" value="Submit"/>
                                                                                   </noscript>
                                                                        </form>
                                                                </td>
                                                </tr>
                                        </tr>
                                </table> ';
}
else if (isset($_POST["data"]))
{
        // put whatever db process you need somwhere in this if statement

         $table1 = '
                        <table id= "Table1" width="100%" border="1" cellspacing="0" cellpadding="0">
                                    <!--SW - You need a tr tag around these headers-->
                                    <th >Weeks</th>
                                    <th ><p></p></th>
                                    <th > More Details</th>


                                    <tr id="tr">

                                            <tr id= "tr " >
                                               <td  >gggg</td>
                                               <td >kkkkk</td>
                                               <td >
                                                                    <form name ="dets" method="POST" action="">
                                                                            <input class = "showt" name ="wnumber" id ="wnumber" type="submit" value= "More Details" />
                                                                            <input type="hidden" name="row_id" value="value of row id" />
                                                                            <input type="hidden" name="data" value="wnumber" />

                                                                               <noscript>
                                                                            <input type="submit" value="Submit"/>
                                                                               </noscript>
                                                                    </form>
                                                            </td>
                                            </tr>
                                    </tr>
                            </table> ';


        $table2 = '
                          <div id="Table2">
                                  <table width="100%" border="1"  cellspacing="0" cellpadding="0">
                                          <tr>
                                                  <th id="wekkNum"> wnumber</th>
                                                  <th>Your place</th>
                                                  <th>Your arr</th>
                                          </tr>

                                          <tr >
                                                  <td>hhhh</td>
                                                  <td>kkkk</td>
                                                  <td>jjjj</td>
                                          </tr>

                                  </table>
                          </div>             
                  ';                   
}
?>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
        /*Start Functions*/
        function displayVals() {
                var singleValues = $("select option:selected").text();
                $("#hiddenselect").val(singleValues);
                $("p").html("Procent of : &nbsp &nbsp" + singleValues);
        }
        /*End functions*/

        /*Start Ready*/
        $(document).ready(function(){
                $("select").change(function() {
                        displayVals();
                });
        displayVals();

                $("select#menucompare").change(function() {
                        $("#aform").submit();  
                });
    });
        /*End Ready*/
</script>
<form id="aform" method="post">
        <select id="menucompare" name ="menucompare" size="1" onchange="submitaform()">
                <option selected='selected'>Select one</option>
                <option value="value1" <?php    if ($menucompare == "value1") { echo " selected='selected'"; } ?> >Text 1</option>
                <option value="value2" <?php   if ($menucompare == "value2") { echo " selected='selected'"; } ?> >Text 2</option>
                <option value="value3" <?php   if ($menucompare == "value3") { echo " selected='selected'"; } ?> >Text 3</option>
                <option value="value4" <?php    if ($menucompare == "value4") { echo " selected='selected'"; } ?> >Text 4</option>

        </select>
        <input type="hidden" name="hiddenselect" value="<?php echo $menucompare ;  ?>" />      
</form>
<?php
if (isset($table1))
{
        print $table1;
}
if (isset($table2))
{
        print $table2;
}
?>

this is my whole code.
hope there is fix for this , i have looked all posts but no similar problem.

  • 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-06-03T07:22:10+00:00Added an answer on June 3, 2026 at 7:22 am

    $_POST values are only available on the page immediately following form submission.

    An easy way to keep user input through multiple pages is to pass it as hidden form fields.

    So you would add a hidden form field to your ‘dets’ forms:

    <input type="hidden" name="menucompare" value="'. $menucompare.'" />
    

    Also, you’ll have to get rid of the ‘else’ on line 37

    else if (isset($_POST["data"]))
    

    to

    if (isset($_POST["data"]))
    

    Try this

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find a solution for this problem. This is my example code:
how i can find the abc from this tag through JAVA code and SAX
I didn't find a solution for this but I think it should be doable.
This may be a common problem but I'm struggling to find a solution that
I have spent three days trying to find the solution to this problem to
I was googling this problem for many days but I didn't find a solution
After much searching trying to find the best solution to using an embedded DB
This code didn't works as expected. I want to select all the posts that
I had this working in an old code that I didn’t end up using...
I didn't understand ..why I am facing this error.. Here is my code: package

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.