Re: Doing something wrong

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Well... first off 'this one page' in php-mysql land can be in fact a  
many tiered complex application which may comprise many many lines of  
code. Ill suggest keeping it very simple at first and then perhaps  
just commenting sections that are too simple for possible reuse later.

OK, now I'll assume some of your page is working? Of couse, that  
would depend upon a great many things like your mysql setup and data  
and your version of php. I'd suggest adding some debugging code in  
the page to start with, perhaps just after your h1 ends:

<? $debug = 1;

if ($debug) {
	echo "\$_REQUEST["code"] = " . $_REQUEST["code"] . "<br>\n";

}
?>

This way you may switch $debug on and off as you like in one place,  
and insert as many statements wherever in the fashion of if $debug  
{ (show me some stuff) }  One favorite debug dump for me is to  
construct my sql string and then print it out so I can paste it into  
phpmyadmin's sql window to see whether my syntax is ok.

Are you one of the new refugees from VBScript? I ask because Im  
wondering if the _Request object is OK? I usually use _POST['code']  
to grab that item myself, and request.whatever reminds me of the bad  
old days... ;)

-m



On Mar 25, 2006, at 1:19 PM, teacherweeks wrote:

> I have been working on this one page for 2 days now, and can't figure
> out what I am doing. So I thought I would turn to the wise souls here
> in PHP land.  I am building a selection list that uses a sql query to
> build the values.  I then want to pass the selected value back to the
> database. This is a data entry form.  Any help anyone can give me
> would be great.
>
>
> <html>
> <head><title>Technology Education Lesson Plan Database</title><link
> href="/Library/general.css" rel="stylesheet" type="text/css"></head>
> <body>
> <h1>National Benchmark Entry</h1>
> <form action='benchmarkaddnational.php' method='post' name='National
> Benchmarks'>
> 	<?
> 	$id = $_REQUEST["rec_id"];
> 	$name = $_REQUEST["name"];
> 	$DBconn = mysql_connect("archammer", "DBuser", "password");
> 	mysql_select_db("tessmerproject", $DBconn) or die(mysql_error
> ());
> 		// create the query
> 		$sql = "select code from tbl_national_goal_seed order
> by code";
> 		$results = mysql_query($sql, $DBconn);
> 		print "<select name='code'>";
> 		while ($row = mysql_fetch_array($results)){
> 			$code = $row['code'];
> 		print "<option value='$code'>$code</option>";
> 	}
> 	print $code;
> 	$sql = "INSERT INTO tbl_unit_national (id, name, natcode)
> VALUES ('$id','$name', '$codeselection')";
> 	$results = mysql_query($sql, $DBconn)
> 	?>
> 	<input name="Submit" type="submit" value="Submit">
> </form>
> </body>
> </html>
>
>
>
>
>
> PHP Data object relational mapping generator
> http://www.metastorage.net/
> Yahoo! Groups Links
>
>
>
>
>
>
>



PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux