Another Easy Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ut1205
Forum Commoner
Posts: 32
Joined: Thu Jan 29, 2004 5:12 pm

Another Easy Question

Post by ut1205 »

As a total newbe this routine task is driving me crazy.

I have a query that returns these values:

Code: Select all

<?php
$Query = "SELECT ID,Last,First,Extension,Employer,Pagers_Cell
FROM `directory`
WHERE ID LIKE'$ID'";
?>
The value for "ID" is provided from a "post" on a form on the previous page.
I want to create "Input" blocks that will echo the values in the query for editing and then carry the values to the next page for execution with another sql script.

I know the statment should look something like this:

Code: Select all

<?php
<input name="First" type="text" id="First" value="<?php echo xxxxx;?>">
?>
But I'm not getting somethin right. Do I need to convert them to $xxx first.

Totally lost. Any help would be appreciated
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

$_GET['XXX'] ?
ut1205
Forum Commoner
Posts: 32
Joined: Thu Jan 29, 2004 5:12 pm

Still Not Working

Post by ut1205 »

It's still not picking up values from the query. When I go to the next page there is nothing there. Here is the entire script. It's just a test script so the text might not make any sense. When this page is executed the information in the "table" prints out fine but it is not passing the info through to the "Get" code. Any suggestions?

Code: Select all

<?php
<HTML>

<HEAD>
</HEAD>

<body bgcolor="#A00000" link="#FFFF00" vlink="#FFFF00" alink="#FFFF00">

<?php
// Set the variables for the database access:
include ("sqllogininfo.php");

$ID = ("".$HTTP_POST_VARS['ID']."");

$Link = mysql_connect ($Host, $User, $Password)
or die ("Couldn't Connect to Server");

$Query = "SELECT ID,Last,First,Extension,Employer,Pagers_Cell
FROM `directory`
WHERE ID LIKE'$ID'";

$Result = mysql_db_query ($DBName, $Query, $Link)
or die ("Couldn't Execute Query");

// Create a table.
print ("<TABLE BORDER=2 WIDTH="50%" CELLSPACING=2 bordercolor="#000000" CELLPADDING=2 ALIGN=CENTER bgcolor="#FFFFCC">\n");
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");

print ("<TD ALIGN=CENTER VALIGN=TOP><b>ID</b></TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><b>Last</b></TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><b>First</b></TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><b>Extension</b></TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><b>Cell/Pager</b></TD>\n");
print ("</TR>\n");

// Fetch the results from the database.
while ($Row = mysql_fetch_array ($Result)) {
         print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
         print ("<TD ALIGN=LEFT VALIGN=TOP>$Row[ID]</TD>\n");
         print ("<TD ALIGN=LEFT VALIGN=TOP>$Row[Last]</TD>\n");
         print ("<TD ALIGN=LEFT VALIGN=TOP>$Row[First]</TD>\n");
         print ("<TD ALIGN=LEFT VALIGN=TOP>$Row[Extension]</TD>\n");
         print ("<TD ALIGN=LEFT VALIGN=TOP>$Row[Pagers_Cell]</TD>\n");
         print ("</TR>\n");
}
mysql_close ($Link);
print ("</TABLE>\n");
?>

<p align="center"><b><font size="4" color="#FFFFFF">You Have Chosen This Entry
to Delete.<br>
Select "<u>Delete</u>" Below to <u>Delete This Entry<br>
</u>or Click <a href="Form.php"> Here</a> to Search Again.</font></b></p>

<FORM ACTION="deleteexe.php" METHOD=Get>

<INPUT TYPE=HIDDEN NAME="Last" VALUE="<?php echo $_GET['Last'];?>">
<INPUT TYPE=HIDDEN NAME="First" VALUE="<?php echo $_GET['First'];?>">

<INPUT TYPE=SUBMIT NAME="Submit" VALUE="Submit!">

</BODY>
</HTML>
?>
Post Reply