Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-22-2004, 01:53 PM   PM User | #1
sctwest
New to the CF scene

 
Join Date: Mar 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
sctwest is an unknown quantity at this point
I am getting undefined variable when I open my page?

This code is from a book that I am using to learn PHP. This same code works on my search form but not my data entry page. I am trying to put a select box on my data entry page.

$connection = mysql_connect('localhost','sctwest','kermit') or die(mysql_error());
$table_name = "assignto_tbl";
$assign = "SELECT Distinct assignTo FROM $table_name ORDER BY assignTo";
$result = mysql_query($assign,$connection) or die(mysql_error());
$num = mysql_num_rows($result);
if ($num < 1) {
$display_block = "<p><em>Sorry! No Results.</em></p>";
} else {

while ($row = mysql_fetch_array($result)) {
//$_id = $row['_id'];
$assignTo = $row['assignTo'];
$option_block .= "<option value=\"$assignTo\">$assignTo</option>";

$display_block = "
<FORM METHOD=\"POST\" ACTION=\"FOIA_dataentry_frm.php\">
<p><strong>assignTo:</strong>
<select name =\"assignTo\">
$option_block
</select>

<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select this Name\"></p>
</form>";
}


This is the part of my HTML that is giving me the errors. I get undifined variable $display_block when I open this page even though it is defined above.

<tr>
<td>
Assigned To:
<?php echo "$display_block"; ?>
Received CAO:
<input name="recvd_cao" size="10">
Rose Boyd Review:
<input name="rb_review" size="10">
</td>
</tr>

THANKS!
sctwest is offline   Reply With Quote
Old 03-22-2004, 02:08 PM   PM User | #2
DsgnrsTLZAdmin
Regular Coder

 
Join Date: Jan 2004
Location: Georgia
Posts: 306
Thanks: 0
Thanked 0 Times in 0 Posts
DsgnrsTLZAdmin is an unknown quantity at this point
$display_block is being printed outside of the delimiters it was defined in...And I dont see any delimiters for the code at all..
__________________
~Designer's Toolz~
DsgnrsTLZAdmin is offline   Reply With Quote
Old 03-22-2004, 02:16 PM   PM User | #3
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Care to show how your code looks without editing it? What you've shown you're not
a)Selecting a database
b)Not closing php for the html (<?php ?>)
c)Not closing off the elsestatement
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 03-22-2004, 02:32 PM   PM User | #4
sctwest
New to the CF scene

 
Join Date: Mar 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
sctwest is an unknown quantity at this point
Unhappy OK, let me rephrase my question. Sorry I am new at this!

I am trying to put a select box on my data entry form. My data entry form stores data in the (dataentry_tbl) and the select box would grab data from a table (assign_tbl). I have the data entry form done and it works but I am confused on how to make another connection for the select box.

Can someone give me an example of how I can do this?
sctwest is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:47 AM.


Advertisement
Log in to turn off these ads.