Jump to content

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>';
			}
?>

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.