Jump to content

Recommended Posts

Hi,

 

  I am new to php, I have a table whose values are populated from database and What I want is

User should be allowed to click these values(values populated from database) and I should redirect him to another page with values in the table and few  more variable values. I was trying with post but there is no sucess.

 

Please suggest me how to do this

Link to comment
https://forums.phpfreaks.com/topic/178254-posting-values-to-a-new-page/
Share on other sites

You simply need to put the filepath of the second page as the first page's form's action attribute, and grab a hold of the correct form inputs.  Simple example:

 

page1.html:

 

<html>
   <head>
      <title>Something</title>
   </head>

   <body>
      <form name="myForm" action="page2.php" method="post">
         Name: <input name="userName" type="text" /><br />
         Password: <input name="userPass" type="password" /><br />
         <input name="submit" type="submit" value="submit" />
      </form>
   </body>

</html>

 

page2.php -

 

<?php
   if(isset($_POST['submit']))
   {
      $user = $_POST['userName'];
      $pass = $_POST['userPass'];

      //continue processing
   }
   else
   {
      //form wasn't submitted...handle this error
   }
?>

Thanks  Nightslyr!!

 

                      But My table looks like this

<td> Position #1 </td>

    <td width="275">

    <?php echo($emp_position[1]);?>

    <a href="temp.php">Click here for detail report</a></td>

    <td><?php echo($emp_startdates[1]);?></td>

    <td><?php echo($emp_enddates[1]);?></td>

    <td><?php echo($duration[1]);?></td>

    <td rowspan="6"><?php echo($totalwithrexam);?></td>

</td>

 

          And I want to send the few values such as $emp_position[1] to "temp.php".

 

Please suggest !!

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.