Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 19th, 2006, 10:10 PM
Authorized User
 
Join Date: Feb 2006
Location: , , .
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default show/hide row(s)

Hi All.
I create form/page and would like to show whole row(s) under NOTE-1 if value of field TYPE is 3 and show whole row(s) under NOTE-2 if value of field TYPE are 1 or 2. And I would like hide whole row(s) under NOTE-1 if value of field TYPE is 3 doesn't exist and hide whole row(s) under NOTE-2 if value of field TYPE are 1 or 2 doesn't exist for according ID. That is my code.
Code:
<?php 
  include ('Connections/dbconn.php'); 

    if (!($connection = @ mysql_pconnect($hostname, $username, $password))) 
        die("Could not connect to database"); 
    if (!mysql_select_db($dbName, $connection)) 
            showerror( ); 

$ID = $_REQUEST['ID']; 
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<title>Untitled Document</title> 
</head> 
<body> 
<form method="POST" action="Update.php" name="update"> 
<table width="100%"  border="0" cellspacing="0" cellpadding="2"> 
<? 
    $query1 = "SELECT ID, Type, Date, Note 
                FROM dbo.Test 
                WHERE ID = " . $ID; 
    if (!($result1 = @ mysql_query($query1, $connection))) 
        showerror( ); 
while($row1 = mysql_fetch_array($result1)) 
{ 
    $formVars = array( ); 
    $formVars['Type'] = $row1['Type']; 
    $formVars['Date'] = $row1['Date']; 
    $formVars['Note'] = $row1['Note']; 

    if ($formVars['Type'] == 3) 
    { 
?> 
  <tr> 
    <td width="7%"><input type="hidden" name="Type" value="<? echo $Type; ?>"></td> 
  </tr> 
  <tr align="center"> 
    <td width="7%"><input name="submit" type="submit" value="add"></td> 
    <td width="18%">DATE</td> 
    <td width="75%">NOTE-1</td> 
  </tr> 
  <tr> 
    <td align="center" valign="bottom"><input name="note" type="submit" value="del"></td> 
    <td> 
<?php 
    if(isset($formVars['Date']) && $formVars['Date'] != "") 
    { 
        $formVars['Date'] = date("m/d/Y", strtotime($formVars['Date'])); 
    } 
?> 
    <input name="NoteDate" type="text" value="<?php echo $formVars['Date']; ?>" size="20"> 
    </td> 
    <td><input type="text" name="Note" value="<?php echo $formVars['Note']; ?>" size=107></td> 
  </tr> 
<? 
    } 
    if ($formVars['Type'] == 1 || $formVars['Type'] == 2) 
    { 
?> 
  <tr> 
    <td colspan="4" align="center">&nbsp;</td> 
  </tr> 
  <tr align="center"> 
    <td width="7%" align="center"><input name="submit" type="submit" value="add"></td> 
    <td width="18%">DATE</td> 
    <td width="75%">NOTE-2</td> 
  </tr> 
  <tr> 
    <td align="center" valign="bottom"><input name="note" type="submit" value="del"></td> 
    <td> 
<?php 
    if(isset($formVars['Date']) && $formVars['Date'] != "") 
    { 
        $formVars['Date'] = date("m/d/Y", strtotime($formVars['Date'])); 
    } 
?> 
    <input name="NoteDate" type="text" value="<?php echo $formVars['Date']; ?>" size="20"> 
    </td> 
    <td><input type="text" name="Note" value="<?php echo $formVars['Note']; ?>" size=107></td> 
  </tr> 
<?    } 
} 
?> 
</table> 
</form> 
</body> 
</html>
Thanks.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide/Show Desktop icons jpool Visual Basic 2005 Basics 0 July 27th, 2008 02:47 PM
HIDE/SHOW pallone Javascript How-To 11 April 16th, 2007 10:24 AM
how to show/hide forms ? ashrafzia C# 3 November 3rd, 2006 11:07 AM
Programatically Show Hide Textboxes miriv365 BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 April 19th, 2005 08:08 PM



All times are GMT -4. The time now is 11:18 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.