Hello,
I'm new to php and i'd like to post the following.
I have written code to get records from a DB and i need one record at a time to be filled in a form i created. Then the next record should be displayed after the user hits the "press any ket button". It does not work
PLEASE HELP !
code is following
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<?php
$labels = array( "user_name" => "User Name", "create_date" => "Creation Date", "password" => "Password",
"last_name" => "Last Name",
"first_name" => "First Name",
"street" => "Street",
"city" => "City",
"state" => "State",
"zip" => "Zip",
"email" => "Email",
"phone" => "Phone",
"fax" => "Fax");
$submit = "Press any key";
include("dbstuff.inc");
$cxn = mysqli_connect($host,$user,$passwd,$databname);
if (!cxn) {
printf("Can't connect to localhost. Errorcode: %dn", mysqli_connect_errno ());
}
else { echo "connection successful !";
}
/* or die ("could not connect to server");*/
$query = "SELECT * FROM customer ";
$result = mysqli_query ($cxn,$query) or die ("could not execute query");
/*$customer = mysqli_fetch_assoc($result);*/
?>
<html>
<head><title>Customer Record</title>
<style type='text/css'>
/*div {background-color:#b0c4de}*/
body {color:blue}
body {background-color:#b0c4de}
<!--
#form {margin: 1.5em 0 0 0;
padding: 15;
}
#field {padding-bottom: 1em;}
label {
font-weight: bold;
float: left;
width: 10%;
margin-right: 1em;
text-align: right;
}
-->
</style>
</head>
<body>
<h3> Customer Details</h3>
<?php
/* Loop that displays the form fields */
/* print_r ($customer);*/
while ($customer = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "<form action = '$_SERVER[PHP_SELF]' method = 'POST'>
<div id='form'>";
foreach($labels as $field => $label)
{
echo "<div id='field'><label for='$field'>$label</label>
<input id='$field' name='$field' type='text'
size='50%' maxlength='65' value = {$customer[$field]} />
</div>n";
} /* foreach*/
echo "<input style='margin-left: 33%' type='submit' value='$submit' />n";
} /*while*/
/*echo "</div>n";*/
/* free result set */
mysqli_free_result($result);
/* close connection */
mysqli_close($cxn);
?>
</form></body></html>
Warning: Cannot modify header information - headers already sent by (output sta
Warning: Cannot modify header information - headers already sent by (output started at /home/praylife/public_html/index.php:29) in /home/praylife/public_html/index.php on line 188Warning: Cannot
Is there a more efficient way to code this than what I have?
I have three associative arrays. $combinedSettings$userSettings$defaultSettingsMy function must combine the key and value from $userSettings and $defaultSettings into the $combinedSettings array.
Loop Through Date Range
Hi guys,
upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please tell me how can i restrict that
Date help - fetch dates for Mondays between xxx and yyy?
Does anyone know the best way to do this? I have two dates, say:2010-01-26 and 2010-05-30and I want to return the dates of all the Mondays between them:2010-02-012010-02-082010-02-15....etc.Thanks
Problem assigning value to variable in "IF" function
Does this script makes sense? I am trying to take the value that is set to "authenticat" and write it to authentication.I think it is getting messes up by the $authenticat = "1"
check comment for html
hi, I just wanted to check if a comment a user posts contains HTML, and if it does, to not allow it to be posted.this is my current php, any help would be very much appreciated! thanks.Code:
Converting RGB values to HEX
Code: <?PHP$file_handle = fopen("colors/rgb.csv", "r");while (!feof($file_handle) ) {$line_of_text = fgetcsv($file_handle, 1024);print $line_of_text[2] . $line_of_text[3] .
Sub-domains & calling unique content
Hello,Is there a way use something similar to the $_GET function for a sub-domain? I to be able to have my sub-domains all use the root directory, but have information filtered for a specific
Ten Operator Syntax
Hi Guys,I can't figure out why i am getting a parse error with this basic ten op code:$prodTH = ($prodIA == "Y") ? "<img src=\"" . amazon_display_thumbnail($prodID)