passing php variable to html - is it possible?

In the code listed below, I want to be able to pass the value from the varibles in the sql select statement to the html page below. (Note: the only one I'm trying is the $company variable, I'll do the rest when I get that to work.) The problem is that no matter what I use in the value clause in the html, it doesn't evaluate the variable to the value. Can anyone help me out? I'm new to this, so I'm pretty sure I'm doing something silly to cause this.

Code:
[code]
<?php
$link = mysql_connect('xxxxxxxxxxx.net:4444', 'xxxxxx', 'pw','db');
if (!$link) {
printf("Connect failed: %s
", mysql_error());
exit();
} else {
// select the database
$db_selected = mysql_select_db('testdb', $link);
if (!$db_selected) {
die ('Select db failed: testdb: ' . mysql_error());
}
// Perform Query
$query ="select * from leadsTable";
$result = mysql_query($query);
$rows=mysql_num_rows($result);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
} else {
while ($newArray = mysql_fetch_array($result, MYSQL_ASSOC)) {
$id = $newArray['id'];
[b][red]$company = $newArray['company_name'];[/red][/b]
$contact = $newArray['contact'];
$phone = $newArray['phone'];
$fax = $newArray['fax'];
$street = $newArray['street'];
$city = $newArray['city'];
$state = $newArray['state'];
$zip = $newArray['zip'];
$job_type = $newArray['job_type'];
$license_class = $newArray['license_class'];
$experience = $newArray['experience'];
$date_found = $newArray['date_found'];
$date_of_contact = $newArray['date_of_contact'];
$notes = $newArray['notes'];
echo "ID is ".$id.
"<br/>Company: ".$company.
"
Contact: &nbsp ".$contact.
"
Phone: &nbsp &nbsp ".$phone.
"
Fax: &nbsp &nbsp &nbsp &nbsp ".$fax.
"
Street: &nbsp &nbsp ".$street.
"
City: &nbsp &nbsp &nbsp &nbsp ".$city.
"
State: &nbsp &nbsp &nbsp ".$state.
"
Zip: &nbsp &nbsp &nbsp &nbsp ".$zip.
"
Job Type: &nbsp ".$job_type.
"
License: $nbsp ".$license_class.
"
Experience: ".$experience.
"
Date Found: ".$date_found.
"
Date of Contact: ".$date_of_contact.
"
Notes: $nbsp ".$notes.
"
------------------------------
";
}
echo "Rows returned: ". $rows;
}
}
//mysql_free_result($result);
?>

Update Leads Table

[b][red]
This php echo statement displays the value I'm looking for!
[/red][/b]
<? echo "company $company<br>"; ?>
         
             
Update Lead
Company : Date Found :



[/code]

Comments

  • You are forgetting to tell the parser that the Value is a PHP variable...

    change
    [code][/code]

    to
    [code][/b]">[/code]
  • You are forgetting to tell the parser that u have switched to PHP ...

    change
    [code][/code]

    to
    [code][/b]">[/code]
  • Thank you very much! I'm new to this, so I'll make sure to remember this in the future!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion