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>
Calander layout
Hi i know this sounds like a simple question but i cant find the answer to it anywhere i have added a simple calander tool to the page and added some styles to it but i want to move the month name
Contact Form Not Working When I Add Validation Codes
So I built my first working PHP "Contact Us" like form. But, I have been trying to now make the form Validate for empty fields when the user hits the submit button. Problem is when I added
Dynamic links in an include file
I am working on a small piece of code that counts records from a database and displays the result to the user. Everything works fine, except I am running into difficulties with dynamic links.The code
Company Code for Vendors created through Business Partners
Hi, experts!
Printer configuration
Hi All,
losing session vars when arriving from an email link
Hi,I've got a confirmation script made that sends an email with a link for a user to confirm their email. This all works pretty good with the exception of not being able to direct them to where they
classic dynpro : hide area and auto adjust hights
Hi,
mail() says sent but no email received
My code is quite simple:Code: <?php$to = "Ty44ler@yahoo.com";$subject = "Test mail";$message = "Hey, I just wanted to see if the script worked.";$from =
convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javascript array. is this possible? I tried with Json_encode but it doesn't seem to work. is there
breaking a text file into paragraphs based on strings
I have a text file of email addresses that is all squished together. It looks like this: abcd@gmail.comfefef@mail.comfefefef@yahoo.comfewferf@mail.net...What I want to do is insert a paragraph after