0

Hi..

I need some help from all of you.
My link cannot go to the next page when i include index.php?page= in my line.Like the example below..

<td><div align="center"><a href="index.php?page=view_user.php?ref1=<?php echo $row['user_id'];?>">View</a></div></td>

If I remove the index.php?page= , the page can link to the page that i want to go.

Can anyone help me to solve this problem? Really need your help. Thanks..

Edited by diafol: apply code tags

4
Contributors
8
Replies
10
Views
5 Years
Discussion Span
Last Post by aecha
0

If the purpose of the link is to go to view_user.php then you can just leave off "index.php?page=" if you are trying to accomplish something else, or are going about this from a different perspective, we will need more code than what you provided.

0

Yep, use ampersand!

<a href="index.php?page=view_user.php&ref1=<?php echo $row['user_id'];?>">
0

Thanks for the replying but still cannot solve it.
I want to use the same index to display the another page/form
This is the code for the list.php which have the code of index.php?page=view_user.php&ref1=..

list_user.php

<?
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("IJA", $con);
$result = mysql_query("SELECT * FROM userdb");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PROTON - Internal Job Application Online</title>
</head>

<body>



<table width="590" border="0" align="center">
  <tr>
    <td width="181"><div align="center"><strong>Name</strong></div></td>
    <td width="100"><div align="center"><strong>Username</strong></div></td>
    <td width="96"><div align="center"><strong>Password</strong></div></td>
    <td width="52"><div align="center"><strong>View</strong></div></td>
    <td width="68"><div align="center"><strong>Update</strong></div></td>
    <td width="67"><div align="center"><strong>Delete</strong></div></td>
  </tr>

   <?php while($row = mysql_fetch_array($result))
                {

                ?>

  <tr>
    <td><div align="center"><?php echo $row['user_name']; ?></div></td>
    <td><div align="center"><?php echo $row['user_username']; ?></div></td>
    <td><div align="center"><?php echo $row['user_password']; ?></div></td>
    <td><div align="center"><a href="index.php?page=view_user.php?&ref1=<?php echo $row['user_id'];?>">View</a></div></td>
    <td><div align="center"><a href="index.php?page=update_user.php?&ref1=<?php echo $row['user_id'];?>">Update</a></div></td>
    <td><div align="center"><a href="delete_user.php?id=<?php echo $row['user_id'];?>">Delete</a></div></td>
  </tr>
  <?php }?>
</table>



</body>
</html>
<?php 
mysql_close($con);
?>

for the view_user.php

<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("IJA", $con);
$page = $_REQUEST['page'];
$ref1 = $_REQUEST['ref1'];
$result = mysql_query("SELECT user_staff_no, user_name, user_username, user_password, user_level FROM userdb WHERE user_id = '$ref1' LIMIT 0,1");
?>

<form name="form1" method="post" action="index.php?=view_user.php">

<p>&nbsp;</p>

 <?php while($row = mysql_fetch_array($result))
                {

                ?>

<table width="558" border="0" align="center">
  <tr>
    <td width="113"><strong>Name</strong></td>
    <td width="11"><div align="center">:</div></td>
    <td width="420">
      <label></label>
    <?php echo $row['user_name'] ?></td>
  </tr>
  <tr>
    <td><strong>Staff Id </strong></td>
    <td><div align="center">:</div></td>
    <td>
      <label></label>
   <?php echo $row['user_staff_no'] ?></td>
  </tr>
  <tr>
    <td><strong>Username</strong></td>
    <td><div align="center">:</div></td>
    <td>
      <label></label>
 <?php echo $row['user_username'] ?></td>
  </tr>
  <tr>
    <td><strong>Password</strong></td>
    <td><div align="center">:</div></td>
    <td>
      <label></label>
      <label></label>
    <?php echo $row['user_password'] ?></td>
  </tr>
  <tr>
    <td><strong>Access Level </strong></td>
    <td><div align="center">:</div></td>
    <td><?php echo $row['user_level'] ?>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
   <?php }?>
  <tr>
    <td colspan="3"><div align="center">

        <label>
          <input name="back" type="submit" id="back" value="Back" />
          </label>
        <label></label>

    </div></td>
  </tr>

<?php 
mysql_close($con);
?>

</table>
<p>&nbsp;</p>
<p align="left"><strong>Access Level description:</strong><br />
  Level 1   : Admin page<br />
  Level 2   : HRA page</p>
</form>

I hope everyone can help me.Thanks

Edited by diafol: apply code tags

0

I don't understand what you are trying to do. Why are you trying to load a page within another instead of just taking them to a new page? And where is the iframe and the conditionals to load in the different page into the index page? If you are just trying to send to a new page then you don't need the index.php?.

Your form action won't work either as it is wrong

<form name="form1" method="post" action="index.php?=view_user.php">

It should be

<form name="form1" method="post" action="index.php?page=view_user.php">
0

simplypixie,

still cannot be working..
I already do it early..

0

Please only post the relevant code, in a code tags, so that its easier to read.

Also can you explain what it is that you are trying to achieve?

0

Ok. I start from the beginning. I try to view the page from the list page. If i dont put index.php?page= at the <a href="index.php?page=view_user.php?&ref1=<?php echo $row['user_id'];?>">View</a>, the view page can be view but not in the same index. they go to the next page. I want the view page can be view in the same page of index.php. Do you understand? This is the example what I am trying to say.

This is the code for list_user.php

<?
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("IJA", $con);
$result = mysql_query("SELECT * FROM userdb");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PROTON - Internal Job Application Online</title>
</head>

<body>



<table width="590" border="0" align="center">
  <tr>
    <td width="181"><div align="center"><strong>Name</strong></div></td>
    <td width="100"><div align="center"><strong>Username</strong></div></td>
    <td width="96"><div align="center"><strong>Password</strong></div></td>
    <td width="52"><div align="center"><strong>View</strong></div></td>
    <td width="68"><div align="center"><strong>Update</strong></div></td>
    <td width="67"><div align="center"><strong>Delete</strong></div></td>
  </tr>

   <?php while($row = mysql_fetch_array($result))
                {

                ?>

  <tr>
    <td><div align="center"><?php echo $row['user_name']; ?></div></td>
    <td><div align="center"><?php echo $row['user_username']; ?></div></td>
    <td><div align="center"><?php echo $row['user_password']; ?></div></td>
    <td><div align="center"><a href="index.php?page=view_user.php?&ref1=<?php echo $row['user_id'];?>">View</a></div></td>
    <td><div align="center"><a href="index.php?page=update_user.php?&ref1=<?php echo $row['user_id'];?>">Update</a></div></td>
    <td><div align="center"><a href="delete_user.php?id=<?php echo $row['user_id'];?>">Delete</a></div></td>
  </tr>
  <?php }?>
</table>



</body>
</html>
<?php 
mysql_close($con);
?>

And this is the code for view_user.php

<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("IJA", $con);
$page = $_REQUEST['page'];
$ref1 = $_REQUEST['ref1'];
$result = mysql_query("SELECT user_staff_no, user_name, user_username, user_password, user_level FROM userdb WHERE user_id = '$ref1' LIMIT 0,1");
?>

<form name="form1" method="post" action="index.php?page=view_user.php">

<p>&nbsp;</p>

 <?php while($row = mysql_fetch_array($result))
                {

                ?>

<table width="558" border="0" align="center">
  <tr>
    <td width="113"><strong>Name</strong></td>
    <td width="11"><div align="center">:</div></td>
    <td width="420">
      <label></label>
    <?php echo $row['user_name'] ?></td>
  </tr>
  <tr>
    <td><strong>Staff Id </strong></td>
    <td><div align="center">:</div></td>
    <td>
      <label></label>
   <?php echo $row['user_staff_no'] ?></td>
  </tr>
  <tr>
    <td><strong>Username</strong></td>
    <td><div align="center">:</div></td>
    <td>
      <label></label>
 <?php echo $row['user_username'] ?></td>
  </tr>
  <tr>
    <td><strong>Password</strong></td>
    <td><div align="center">:</div></td>
    <td>
      <label></label>
      <label></label>
    <?php echo $row['user_password'] ?></td>
  </tr>
  <tr>
    <td><strong>Access Level </strong></td>
    <td><div align="center">:</div></td>
    <td><?php echo $row['user_level'] ?>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
   <?php }?>
  <tr>
    <td colspan="3"><div align="center">

        <label>
          <input name="back" type="submit" id="back" value="Back" />
          </label>
        <label></label>

    </div></td>
  </tr>

<?php 
mysql_close($con);
?>

</table>
<p>&nbsp;</p>
<p align="left"><strong>Access Level description:</strong><br />
  Level 1   : Admin page<br />
  Level 2   : HRA page</p>
</form>

Thank you..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.