new_php85 Posted November 7, 2008 Share Posted November 7, 2008 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 https://forums.phpfreaks.com/topic/131750-why-the-page-is-empty/ Share on other sites More sharing options...
samf_20 Posted November 11, 2008 Share Posted November 11, 2008 <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 https://forums.phpfreaks.com/topic/131750-why-the-page-is-empty/#findComment-687854 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.