1 Replies - 10632 Views - Last Post: 02 October 2011 - 03:13 AM Rate Topic: -----

#1 menukadevinda  Icon User is offline

  • D.I.C Regular

Reputation: -7
  • View blog
  • Posts: 470
  • Joined: 14-April 11

passing session variable via post method

Posted 02 October 2011 - 01:37 AM

hi all I tried to passe the variable to another php file but didnt work.
I want to passe email variable.

here is the code
 <form action="reply.php" method="POST">
                                <label style="background-color: white;width: 300px; color: black;">
                                <?php echo 'To'.'&nbsp'.'&nbsp'.$_SESSION['email'];
                                $email=$_SESSION['email'];
                                
                                ?>
                                </label>
                                   <input type="hidden" name="email" value="<?php $email?>" />
                                   <textarea  class="text-input textarea"  id="wysiwyg"  name="emailbody" rows="10" cols="75">
                                    <?php
                   
                                    include_once '../../Classes/DBhandling.php';
                                    $dob = new DBhandling(dbHost,dbUser,dbName,dbPass);
                                    $dob->connectDB();
                                    
                                    $msgId=$_GET["var1"];//message id
                                 
                                                                  
                                    $qrysel="select * from messages where id='$msgId'";
                                    $result= mysql_query($qrysel);
                                       
                                        while ($row=mysql_fetch_array($result)){

                                          echo 'subject:  '.$row['subject']."<br>";
                                          echo $row['title'].$row['name']."<br>";
                                                                              
                                          echo "Message is: ";
                                          echo $row['message'];
                                          echo "<br>";
                                          echo $row['email']."<br>";
                                          $_SESSION['email']=$row['email'];
                                          echo $row['date']."<br>";

                                       }

                                   
                                       session_commit();                       
                                     ?>
                                     </textarea>
                              
                                    <input type="submit" value="Submit" class="btn" /> 
                              </form>















can anybody fingure the problem I get all data except the email.

thx in advance ,
Menuka

Is This A Good Question/Topic? 0
  • +

Replies To: passing session variable via post method

#2 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 542
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: passing session variable via post method

Posted 02 October 2011 - 03:13 AM

Line 8 should have <?php echo email; ?>, not <?php email?>.

For the future, to prevent such confusion, I would highly recommend separating out your HTML from your PHP, as keeping the two together in the same file as you've done will make it drastically harder to read and follow logically, and will only serve to hinder you more and more as your codebase grows.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1