Echo Values Into Fields for Editing Problem?
Posted: Fri Jan 21, 2005 9:54 am
Just messing around with PHP and i wanted a contact form which would get the values out of the database and display them in the relevent fields so if a user wants to edit the details they can while looking at their current details. Everything seems ok except it wont echo the details into the fields. Any ideas?
Code: Select all
<?php
session_start();
require('page.inc'); //page class
require_once('shopping_basket_fns.php');
$customer = $_SESSIONї'customer_id'];
$link_id = db_Connect();
$query = mysql_query("SELECT * FROM customers WHERE customer_id='".$_SESSIONї'customer_id']."'",$link_id);
$c = mysql_fetch_array($query);
echo $_SESSIONї'customer_id'];
echo $cї'postcode'];
echo $cї'first_name'];
function display_checkout_form(){
?>
<br />
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<form method="post" action="purchase.php" enctype="multipart/form-data">
<tr><th colspan="2" bgcolor="#cccccc">Details</th></tr>
<tr>
<td align="right">First Name: </td>
<td><input name="firstName" type="text" maxlength="20" value="<?php echo $cї'first_name']: '' ; ?>"></td>
</tr>
<tr>
<td align="right">Last Name: </td>
<td><input name="lastName" type="text" maxlength="20" value="<?php print $cї'surname']; ?>"></td>
</tr>
<tr>
<td align="right"Title: </td>
<td><input name="initial" type="text" maxlength="4" value="<?php echo $cї'initial']; ?>"></td>
</tr>
<tr>
<td align="right">Address Line One: </td>
<td><input name="addressLineOne" type="text" maxlength="25" value="<?php echo $cї'address_line_one']; ?>"></td>
</tr>
<tr>
<td align="right">Address Line Two: </td>
<td><input name="addressLineTwo" type="text" maxlength="25" value="<?php echo $cї'address_line_two']; ?>"></td>
</tr>
<tr>
<td align="right">City: </td>
<td><input name="city" type="text" maxlength="30" value="<?php echo $cї'city']; ?>"></td>
</tr>
<tr>
<td align="right">County: </td>
<td><input name="county" type="text" maxlength="30" value="<?php echo $cї'county']; ?>"></td>
</tr>
<tr>
<td align="right">Postcode: </td>
<td><input name="postcode" type="text" maxlength="8" value="<?php echo $cї'postcode']; ?>"></td>
</tr>
</form>
</table>
<?
}
display_checkout_form();
?>