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

  • Home
  • SEARCH
  • 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 7633421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:52:42+00:00 2026-05-31T06:52:42+00:00

I do not even know how to google this one…imagine it is something stupid…but

  • 0

I do not even know how to google this one…imagine it is something stupid…but any help would be great…

passing a variable when submitting a form…when echo the $_POST it is good…but when i put it into a php variable it is duplicated

 <?

 //list transactions by month
 if ($_POST['m']=="yes"){
 $table = $_POST['month'];
 $_SESSION['table']=$_POST['month'];

 $conn = mysql_connect("localhost", "mss_records", "3205") or die(mysql_error());
 mysql_select_db('store_records', $conn) or die(mysql_error());

 $result = mysql_query("SELECT * FROM $table");

 while($row = mysql_fetch_array($result))
 {
 $id=$row['transaction'];
 $date=$row['date'];
 $time=$row['time'];
 $paid=$row['payment'];
 $total=$row['total'];
 echo '<style type="text/css">
 <!--
 .list {
 font-family: Georgia, "Times New Roman", Times, serif;
 font-size: 12px;
 color: #000;
 padding: 2px;
 border: 2px solid #009;
 }
 .view {
 width: 100px;
 }
 -->
 </style>
 <div class="list">
 <p><span style="color: #900">Transaction #</span>'.$id.'
 <span style="color: #900">Date:</span>'.$date.'
 <span style="color: #900">Time:</span>'.$time.'<span style="color: #900">
 Paid By:</span>'.$paid.' <span style="color: #900">Total:</span>'
 .number_format($total, 2).'
 <form name="form1" method="post" action="find.php">
 <label>
 <input type="submit" name="view" id="view" value="'.$id.'">
 </label>
 </form>
 </p>
 </div>
 <p></p>';
 }
 }
 //view transaction after viewing by month
 if (isset($_POST['view'])){


 $conn = mysql_connect("localhost", "mss_records", "3205") or die(mysql_error());
 mysql_select_db('store_records', $conn) or die(mysql_error());

 $table = $_SESSION['table'];
 echo "this is the number  ".$_POST['view'];
 $post=$_POST['view'];
 echo "this is the post   ".$post;
 $result = mysql_query("SELECT * FROM $table WHERE transaction = '$post'")
 or die(mysql_error());

 while($row = mysql_fetch_array($result))
 {    
 $items=$row['transaction'];
 }
 echo $items;  
 }
 ?>

after the user goes through the first selection and on the second window the output is…

this is the number 46this is the $post 4646 
  • 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-31T06:52:44+00:00Added an answer on May 31, 2026 at 6:52 am

    Your query is mysql_query("SELECT * FROM $table WHERE transaction = '$post'"). Therefore the value of $items=$row['transaction']; is also going to be 46. When you echo out everything without line breaks, it smashes everything together.

    POST is not duplicating anything, you are just echoing $items directly after it.

    Try this:

    $table = $_SESSION['table'];
      echo "this is the number  ".$_POST['view']."<br /> \n";
      $post=$_POST['view'];
      echo "this is the post   ".$post."<br /> \n";
      $result = mysql_query("SELECT * FROM $table WHERE transaction = '$post'")
      or die(mysql_error());
    
      while($row = mysql_fetch_array($result))
      {    
        $items=$row['transaction'];
      }
      echo $items;  
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not even sure what this is called? But I'm trying to learn what
I am not even sure how to ask this question. I want something that
Hello! I'm not even sure if this is possible, but hopefully it is in
This question is kind of complicated and I do not even know how to
I've made some research on this but haven't found any solution, so I'm not
I'm not even sure if it's possible but say I have some XML: <source>
I'm not even sure how I should phrase this question. I'm passing some CustomStruct
I'm not even sure what this principle is called or how to search for
Why does the C# compiler not even complain with a warning on this code?
I have searched through google and SO for possible answers to this question, but

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.