Jump to content

[SOLVED] displaying text in textboxes


richard_PHP

Recommended Posts

hello all, cant quite get this to work. ive narrowed it down to getting no errors ( :D ) but now it is just not displaying anything.

 

i want there to be an input form with text boxes, each showing address lines (which have been stored in a database).

 

heres the code:

<?php
Connect();

			$sql = "SELECT `firstName`, `address1`, `address2`, `address3`, `city`, `postcode` FROM `Customers` WHERE `firstName` LIKE '".$_SESSION['name']."'";
			$result = mysql_query($sql, $connection);
			$Row = mysql_fetch_array($result);
			while($Row) {
				echo '<tr><td>Address 1</td><td><input type="text" size="3" name="address1" value="<?php echo $array[address1]; ?>" /></td></tr>';
				echo '<tr><td>Address 2</td><td><input type="text" size="30" name="address2" value="<?php echo $array[address2]; ?>" /></td></tr>';
				echo '<tr><td>Address 3</td><td><input type="text" size="30" name="address3" value="<?php echo $array[address3]; ?>"/></td></tr>';
				echo '<tr><td>City</td><td><input type="text" size="30" name="city" value="<?php echo $array[city]; ?>" /></td></tr>';
				echo '<tr><td>Postcode</td><td><input type="text" size="15" name="postcode" value="<?php echo $array[postcode]; ?>" /></td></tr>';
				echo '</table>';
			}
?>

Link to comment
https://forums.phpfreaks.com/topic/151556-solved-displaying-text-in-textboxes/
Share on other sites

changed ARRAY to ROW as it is declared but it still doesnt work.. code:

 

<?php

			$sql = "SELECT `firstName`, `address1`, `address2`, `address3`, `city`, `postcode` FROM `Customers` WHERE `firstName` LIKE '".$_SESSION['name']."'";
			$result = mysql_query($sql, $connection);
			$Row = mysql_fetch_array($result);
			while($Row) {
				echo '<tr><td>Address 1</td><td><input type="text" size="3" name="address1" value="<?php echo $Row[address1]; ?>" /></td></tr>';
				echo '<tr><td>Address 2</td><td><input type="text" size="30" name="address2" value="<?php echo $Row[address2]; ?>" /></td></tr>';
				echo '<tr><td>Address 3</td><td><input type="text" size="30" name="address3" value="<?php echo $Row[address3]; ?>"/></td></tr>';
				echo '<tr><td>City</td><td><input type="text" size="30" name="city" value="<?php echo $Row[city]; ?>" /></td></tr>';
				echo '<tr><td>Postcode</td><td><input type="text" size="15" name="postcode" value="<?php echo $Row[postcode]; ?>" /></td></tr>';
				echo '</table>';
			}
?>

Archived

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

×
×
  • 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.