Jump to content

Hiding my table until the form has been submitted


sjpayling

Recommended Posts

Hi GuysI'm relatively new to coding of any form and need a steer on how i progress the code below... This is a simple form which posts a number into the php/mysql below to get some data from the history table. My issue is that this works fine but the table headers below are visible on the page before i press submit on my form...How would i go about hiding the table until i have pressed submit, feels like this is javascript but don't really know where to begin?Many thanks in advance for any assistance

<body>		<form action="search_actions.php" method="get">			<table border ="1" width="15%" cellpadding="1">				<tr><th align="left" width="80%">Search Action Number:</th><td width="20%"> <input type="text" size="4" name="number" /></td></tr>			</table>			<input type="submit" value="Search Actions"/>		</form>		<?php//Connection String Details$db@ $result = mysql_query("select task_id TASK_ID, action_detail DETAIL, action_comments ACTION,status STATUS, date(opened_date) OPENED, date(update_date) UPDATED, assigned_by ASSIGNED, Business_stream STREAM from actions_db.actions_log_historywhere task_id = '$_GET[number]'and task_id !='0'order by update_date"				)				or die("Query failed with error: ".mysql_error());		echo "<table border='1'><tr><th>Action</th><th>Action Summary</th><th>Action Comments</th><th>Status</th><th>Opened</th><th>Updated</th><th>Assigned By</th><th>Stream</th></tr>";		while($row = mysql_fetch_array($result)) {			echo "<tr>";			echo "<td>" . $row['TASK_ID'] . "</td>";			echo "<td>" . $row['DETAIL'] . "</td>";			echo "<td>" . $row['ACTION'] . "</td>";			echo "<td>" . $row['STATUS'] . "</td>";			echo "<td>" . $row['OPENED'] . "</td>";			echo "<td>" . $row['UPDATED'] . "</td>";			echo "<td>" . $row['ASSIGNED'] . "</td>";			echo "<td>" . $row['STREAM'] . "</td>";			echo "</tr>";		}		echo "</table>";		mysql_close($db);		?>	</body>

Link to comment
Share on other sites

you can use php, and then use the input name of 'number' to identify if a value has been entered, or give a name reference to the submit button to determine if it has been pressed.<?phpif(isset($_GET["number"])) //or submit button name{database connection and table code in here}?>

Link to comment
Share on other sites

you can use php, and then use the input name of 'number' to identify if a value has been entered, or give a name reference to the submit button to determine if it has been pressed.<?phpif(isset($_GET["number"])) //or submit button name{database connection and table code in here}?>
This works a treat... Thanks very much for your input
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...