Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Drop down boxes.. and other stuff..

Links for php scripts

Moderators: macek, egami, gesf

Drop down boxes.. and other stuff..

Postby crsk » Thu Aug 07, 2003 2:12 am

hello.. again...
Right in my mySQL database, I have fields realting to each month of the year, these show the employee's of the month. I want to be able to select a month from a jump/dropdown menu and it then create a page showing the relative month and employee. How ever on rare occasions the award is shared, don't know if that will make a difference, I'd think not.

My variables are.. 'dotm' - the month
'FirstName' and 'LastName'

please take it slow, as I've mentioned in other posts, I'm still a newbie at this stuff..

cheers
Chris
crsk
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Aug 05, 2003 12:28 am

Postby sigix » Thu Aug 07, 2003 4:30 am

just compare the month value with database date (month)
:?:
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby crsk » Thu Aug 07, 2003 7:40 am

okee this one must be really easy.. I think it's something to do with my array, but I'm so knackered I can't see it

Error:
Notice: Undefined index: dotm in c:\program files\apache group\apache\htdocs\input page\january.php on line 10


my code is:

Code: Select all
<?
$connection = mysql_connect( "localhost", "root", "belinea" ) or die( mysql_error() );
mysql_select_db( "phptest" ) or die( mysql_error() );
$id=$HTTP_POST_VARS ["dotm"]; 
$result = mysql_query("SELECT FirstName, LastName, dotm FROM test where dotm = '$id';" ) or die( mysql_error() );
while ($row=mysql_fetch_array($result))
echo( "Designer: ".$row["FirstName"] . " " . $row['LastName']);
echo( "Month: ".$row["dotm"]);
?>


and the error is on:

$id=$HTTP_POST_VARS ["dotm"];

any help would be much appriciated..
crsk
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Aug 05, 2003 12:28 am

Postby swirlee » Thu Aug 07, 2003 7:57 am

crsk wrote:Error:
Notice: Undefined index: dotm in c:\program files\apache group\apache\htdocs\input page\january.php on line 10

...

and the error is on:

$id=$HTTP_POST_VARS ["dotm"];


This would suggest that there's no POST var called "dotm", which would suggest that there's no form field called "dotm". Are you sure you have a form field called "dotm" (double-check your spelling, too)?
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby WiZARD » Fri Aug 08, 2003 2:56 am

I think that problem in double quotes.....
for example you may get error than use include and use double quotes too...... :cry:
in builting variables and in include use once quotes.....
and do not use cpace betwin $HTTP_POST_VARS and ['dotm']
to you need this:
Code: Select all
$id=$HTTP_POST_VARS ["dotm"];

replace at this:
Code: Select all
$id=$HTTP_POST_VARS['dotm'];
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP Scripts

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.