Jump to content

why the page is empty...


new_php85

Recommended Posts

why when i clik Edit link, the next page is empty...

this is my example coding for Edit link page..

 

<?php session_start();
include 'includes/db_connect.php';
include 'includes/css.php';

if(isset($_GET['logout']))
{
$_SESSION['logged_in']=0;
session_destroy();
}	

$q = "SELECT dd, mm, yy FROM date_control";
$result = mysql_query($q) or die('Query failed. ' . mysql_error());
?>

<html>
<head>
<title>MEC</title>

<script type="text/javascript">
function Back()
{
window.location ='listStaff.php';
}
</script>
</head>

<body bgcolor="#9999FF">

<form name="vc" action='view_closing_date.php' method = "post">
<table width="207" align="center">
      <th class="header2" bgcolor="#C0C0C0" width="24"><div align="center">No.</div></th>
	  <th class="header2" bgcolor="#C0C0C0" colspan="3"><div align="center">Duration</div></th>
	  <th class="header2" bgcolor="#C0C0C0" width="209"><div align="center">Edit</div></th>
          <?php
		  $y=1;
	      while($row = mysql_fetch_assoc($result))
		  {
		  ?>
          <tr> 
            <td class="list2"><div align="center"><?php echo $y;?></div></td>
		<td width="37" class="list2"><div align="right"><?php echo $row['mm']?></div></td>
		<td width="30" class="list2"><div align="center">/</div></td>
		<td width="34" class="list2"><div align="left"><?php echo $row['yy']?></div></td>
    		<td class="list2"><div align="center"><a href="editVs.php?vs_id=<?php echo $row['vs_id']?>">Edit</a></div></td>
          </tr>
          <?php 
              $y++;
              } 
		  ?>
<tr> 
	<td colspan="4"></td>
	<td><div align="right">
             <input class="button" type = "button" name = "bttnBack" value = "Back" onClick="Back()"></div></td>
    </tr>
</table>
</form>  
</body>
</html>

 

this is my next page after click link edit

 

<?php session_start();
include 'includes/db_connect.php';
include 'includes/css.php';

$query_dd = "SELECT * FROM days";
$result_dd = mysql_query($query_dd) or die('Query failed. ' . mysql_error());

$query_mm = "SELECT * FROM month";
$result_mm = mysql_query($query_mm) or die('Query failed. ' . mysql_error());

$query_yy = "SELECT * FROM year";
$result_yy = mysql_query($query_yy) or die('Query failed. ' . mysql_error());

if(isset($_GET['logout']))
{
$_SESSION['logged_in']=0;
session_destroy();
}	

if (isset($_POST['bttnEdit']))
{
$vs_id = $_POST['vs_id'];
$dd = $_POST['dd'];
$mm = $_POST['mm'];
$yy = $_POST['yy'];

$data = 1;
$query = "UPDATE date_control SET dd='$dd', mm='$mm', yy='$yy' WHERE vs_id='$vs_id'";
		  
mysql_query($query) or die('Query failed. ' . mysql_error());

echo "<script language='JavaScript'> alert('The record is successfully edited');</script>";
echo "<script language='JavaScript'> window.location ='view_closing_date.php';</script>";
}
?>

<html>
<head>
<title>MEC</title>
<SCRIPT language="JavaScript1.2" src="gen_validation.js"></SCRIPT>
<SCRIPT language="JavaScript1.2">
var arrFormValidation=
[
	[//id
	],

	[//Start Date
		 ["minlen=1",
		  "Please enter date"]
        ],

	[//Closing Date
		 ["minlen=1",
		  "Please enter date"]
        ],

	[//Viewing Date
        ],		
     
];
</SCRIPT>

<script type="text/javascript">
function Back()
{
window.location ='view_closing_date.php';
}	
</script>
</head>

<body bgcolor="#9999FF">

<form name="eventC" action = "editVs.php" method = "post" onSubmit="return validateForm(this,arrFormValidation);">

<?php
if (isset($_GET['vs_id']))
{
	$vs_id = $_GET['vs_id'];
}
else if (isset($_POST['vs_id']))
{
	$vs_id = $_POST['vs_id'];
} 
else
{
	$vs_id = 0;
}

$query2  = "SELECT * FROM date_control WHERE vs_id = '$vs_id'";
$result = mysql_query($query2) or die('Query failed. ' . mysql_error());	

while($row = mysql_fetch_assoc($result))
{
?>
<table width="358" align="center">
<tr> 
    	<td width="99">Id</td>
        <td width="247">: <input class="special" type = "text" name = "vs_id" maxlength = "200" value = "<?php echo $row['vs_id']?>" size = "10"ReadOnly></td>
    </tr>

<tr> 
    	<td>Duration</td>
        <td>: <select class="special" name="dd">
		  <option value="">DD</option>
              <?php 
              while($row_dd = mysql_fetch_assoc($result_dd)) {
              ?>
              <option value="<?php echo $row_dd['days']; ?>"><?php echo $row_dd['days']; ?></option>
              <?php
              }
              ?>
              </select>
		  
		  <select class="special" name="mm">
		  <option value="">MM</option>
              <?php 
              while($row_mm = mysql_fetch_assoc($result_mm)) {
              ?>
              <option value="<?php echo $row_mm['month']; ?>"><?php echo $row_mm['month']; ?></option>
              <?php
              }
              ?>
              </select>
		  
		  <select class="special" name="yy">
		  <option value="">YY</option>
              <?php 
              while($row_yy = mysql_fetch_assoc($result_yy)) {
              ?>
              <option value="<?php echo $row_yy['year']; ?>"><?php echo $row_yy['year']; ?></option>
              <?php
              }
              ?>
              </select></td>
    </tr>

<tr> 
        <td> </td>

      <td> <div align="left">
  	  <input class="button" type = "button" name = "bttnBack" value = "Back" onClick="Back()">
          <input class="button" type = "submit" name = "bttnEdit" value = "Edit">          
        </div></td>
    </tr>
</table>
                     
<?php
}
include "includes/db_close.php";
?>
                    
</form>
</body>
</html>

 

why nothing appear at secod page.....plzz help me

Link to comment
Share on other sites

<td class="list2"><div align="center"><a href="editVs.php?vs_id=<?php echo $row['vs_id']?>">Edit</a></div></td>

 

This may be a problem. If your just solely using that link to just go to the edit page then editVs.php?vs_id=<?php echo $row['vs_id']?> will not be a valid hyperlink to another page. Maybe a http://www.example.com/edit.php or \edit.php would be more appropriate

Link to comment
Share on other sites

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.