form/php problem
Hi y'all,
I've made the below work by combining the 2 pages ( form and php file) into
1, but when I run the separated files the php file isn't run, it's
displayed. Any ideas?
Thanks.
Robert
**************************
Form
**************************
<html>
<head></head>
<body>
<form action="display_details.php" method="post">
<p>Which record would you like to see?</p>
<P>Enter Record #<br>
<input type="text" name="adv_id" size="5">
<input type="submit" value="View Record">
</form>
</body>
</html>
**************************
PHP file (display_details.php)
**************************
<?php
include ("connect.php");
if(!empty($_POST))
{
$adv_id = $_POST['adv_id'];
$result=mysql_query("SELECT * FROM advertiser_tbl WHERE adv_id =
'$adv_id'") or die (mysql_error());
while ($newArray = mysql_fetch_array($result)){
$adv_id = $newArray['adv_id'];
$adv_name = $newArray['adv_name'];
$cont_name = $newArray['cont_name'];
$cont_title = $newArray['cont_title'];
$address = $newArray['address'];
$city = $newArray['city'];
$state = $newArray['state'];
$zip = $newArray['zip'];
$active = $newArray['active'];
$notes = $newArray['notes'];
echo "<br><br>$adv_id: <b>$adv_name</b><br>";
echo "<b>Contact:</b> $cont_name <b>Title:</b> $cont_title<br>";
echo "$address<br>";
echo "$city, $state $zip<br>";
if ($active=="1") echo "<b>Active</b><br>";
echo "Notes: $notes<br><br>";
}}
?>
Re: form/php problem
Figured it. Just change the name of the form from htm to php. =)
"Mr. Newt" <lektrikpuke [at] _yahoo.com> wrote in message
news:PbGdnUz5w6YCWfzbnZ2dnUVZ_uuqnZ2d [at] comcast.com...
> Hi y'all,
>
> I've made the below work by combining the 2 pages ( form and php file)
> into 1, but when I run the separated files the php file isn't run, it's
> displayed. Any ideas?
>
> Thanks.
>
> Robert
>
> **************************
> Form
> **************************
> <html>
> <head></head>
> <body>
> <form action="display_details.php" method="post">
> <p>Which record would you like to see?</p>
> <P>Enter Record #<br>
> <input type="text" name="adv_id" size="5">
> <input type="submit" value="View Record">
> </form>
> </body>
> </html>
>
> **************************
> PHP file (display_details.php)
> **************************
> <?php
> include ("connect.php");
>
> if(!empty($_POST))
> {
> $adv_id = $_POST['adv_id'];
> $result=mysql_query("SELECT * FROM advertiser_tbl WHERE adv_id =
> '$adv_id'") or die (mysql_error());
> while ($newArray = mysql_fetch_array($result)){
> $adv_id = $newArray['adv_id'];
> $adv_name = $newArray['adv_name'];
> $cont_name = $newArray['cont_name'];
> $cont_title = $newArray['cont_title'];
> $address = $newArray['address'];
> $city = $newArray['city'];
> $state = $newArray['state'];
> $zip = $newArray['zip'];
> $active = $newArray['active'];
> $notes = $newArray['notes'];
>
> echo "<br><br>$adv_id: <b>$adv_name</b><br>";
> echo "<b>Contact:</b> $cont_name <b>Title:</b> $cont_title<br>";
> echo "$address<br>";
> echo "$city, $state $zip<br>";
> if ($active=="1") echo "<b>Active</b><br>";
> echo "Notes: $notes<br><br>";
> }}
>
> ?>
>