This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > March 2006 > Help with PHP Form





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Help with PHP Form
James0816

2006-03-28, 6:29 pm

I tried to create a PHP from using DW instead of all the manual typing (thought
i would be making life easier). However, it doesn't work. My results page is
blank. I will provide the short testing code for review:

here is my search page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#dnum {
position: absolute;
top: 100px;
left: 100px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
#Layer1 {
position:absolute;
width:214px;
height:20px;
z-index:1;
left: 150px;
top: 124px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
#Layer2 {
position:absolute;
width:64px;
height:27px;
z-index:2;
left: 366px;
top: 109px;
}
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="getresults.php">
<div id="dnum">Drawing Number:
<input name="DNum" type="text" /></div>


<div id="Layer1">Keyword:
<input name="DKey" type="text" /></div>


<div id="Layer2">
<label>
<input type="submit" name="Submit" value="Search" />
</label>
</div>
</form>
</body>
</html>


and here is my results page:
<?php require_once('../Connections/BirchTest.php'); ?>
<?php
$varDN_BirchTest = "%";
if (isset($_POST)) {
$varDN_BirchTest = (get_magic_quotes_gpc()) ? $_POST : addslashes($_POST);
}
mysql_select_db($database_BirchTest, $BirchTest);
$query_BirchTest = sprintf("SELECT main.dnum, main.dype, main.ddesc FROM main
WHERE main.dnum LIKE '%s'", $varDN_BirchTest);
$BirchTest = mysql_query($query_BirchTest, $BirchTest) or die(mysql_error());
$row_BirchTest = mysql_fetch_assoc($BirchTest);
$totalRows_BirchTest = mysql_num_rows($BirchTest);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>
<?php
mysql_free_result($BirchTest);
?>

It works if I run the query from the RecordSet section. I don't see where it
is actually picking up the parameter being passed. this code looks very odd to
me. Does it not to anyone else? (its all DW coded no manual edits).

thx

James0816

2006-03-28, 6:29 pm

sry....wrong form on the results page.....here is the right code:
<?php require_once('../Connections/BirchTest.php'); ?>
<?php
$varDN_BirchTest = "%";
if (isset($_POST)) {
$varDN_BirchTest = (get_magic_quotes_gpc()) ? $_POST : addslashes($_POST);
}
mysql_select_db($database_BirchTest, $BirchTest);
$query_BirchTest = sprintf("SELECT main.dnum, main.dype, main.ddesc FROM main
WHERE main.dnum LIKE '%s'", $varDN_BirchTest);
$BirchTest = mysql_query($query_BirchTest, $BirchTest) or die(mysql_error());
$row_BirchTest = mysql_fetch_assoc($BirchTest);
$totalRows_BirchTest = mysql_num_rows($BirchTest);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table width="513" border="1">
<tr>
<td><?php echo $row_BirchTest; ?></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($BirchTest);
?>

James0816

2006-03-28, 6:29 pm

No help on this?

What do you put in for the Run-Time Value when coding your Select statement? Been working all day with no results. Could use a little help if someone doesn't mind.

thx
.: Nadia :. *ACE*

2006-03-28, 6:29 pm

See if Garys' PHP form tutorial helps you.

PS: I note you are using layers - didn't you read the whole thread when you
posted your last question? If not, I'd go back and read it ........


--
Nadia
Adobe Community Expert : Dreamweaver:
--------------------------------------------
http://www.csstemplates.com.au - CSS Templates | Free Templates
http://www.DreamweaverResources.com - Dropdown Menu Templates|Tutorials
http://www.macromedia.com/devnet/dreamweaver/css.html - CSS Tutorials
-------------------------------------------------


"James0816" <webforumsuser@macromedia.com> wrote in message
news:e09lbe$21l$1@forums.macromedia.com...
>I tried to create a PHP from using DW instead of all the manual typing
>(thought
> i would be making life easier). However, it doesn't work. My results
> page is
> blank. I will provide the short testing code for review:
>
> here is my search page:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>Untitled Document</title>
> <style type="text/css">
> <!--
> #dnum {
> position: absolute;
> top: 100px;
> left: 100px;
> font-family: Verdana, Arial, Helvetica, sans-serif;
> font-size: small;
> }
> #Layer1 {
> position:absolute;
> width:214px;
> height:20px;
> z-index:1;
> left: 150px;
> top: 124px;
> font-family: Verdana, Arial, Helvetica, sans-serif;
> font-size: small;
> }
> #Layer2 {
> position:absolute;
> width:64px;
> height:27px;
> z-index:2;
> left: 366px;
> top: 109px;
> }
> .style1 {
> font-family: Verdana, Arial, Helvetica, sans-serif;
> font-size: small;
> }
> -->
> </style>
> </head>
>
> <body>
> <form id="form1" name="form1" method="post" action="getresults.php">
> <div id="dnum">Drawing Number:
> <input name="DNum" type="text" /></div>
>
>
> <div id="Layer1">Keyword:
> <input name="DKey" type="text" /></div>
>
>
> <div id="Layer2">
> <label>
> <input type="submit" name="Submit" value="Search" />
> </label>
> </div>
> </form>
> </body>
> </html>
>
>
> and here is my results page:
> <?php require_once('../Connections/BirchTest.php'); ?>
> <?php
> $varDN_BirchTest = "%";
> if (isset($_POST)) {
> $varDN_BirchTest = (get_magic_quotes_gpc()) ? $_POST :
> addslashes($_POST);
> }
> mysql_select_db($database_BirchTest, $BirchTest);
> $query_BirchTest = sprintf("SELECT main.dnum, main.dype, main.ddesc FROM
> main
> WHERE main.dnum LIKE '%s'", $varDN_BirchTest);
> $BirchTest = mysql_query($query_BirchTest, $BirchTest) or
> die(mysql_error());
> $row_BirchTest = mysql_fetch_assoc($BirchTest);
> $totalRows_BirchTest = mysql_num_rows($BirchTest);
> ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>Untitled Document</title>
> </head>
>
> <body>
> </body>
> </html>
> <?php
> mysql_free_result($BirchTest);
> ?>
>
> It works if I run the query from the RecordSet section. I don't see where
> it
> is actually picking up the parameter being passed. this code looks very
> odd to
> me. Does it not to anyone else? (its all DW coded no manual edits).
>
> thx
>



James0816

2006-03-28, 6:30 pm

thx...where might i find the tutorial?

read the post on the frames....for my form page it is just a test nothing final. Just something to try and get familiar with the process.
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews