[PHP] RE: [newbie] drop down boxes
Hiya, I have created a dynamic table within my form. Above the table I want to insert a filter to order by:the column names Here is the static list: select name=select4 optionSeverity/option optionCrash/option optionMajor/option optionMinor/option optionReview/option /select What I need suggestions on is: 1. recommended tutorials on lists and logic behind them. 2. How does the selected item in the list get stored (a variable?)and how can I place that in such a way to ORDER BY $filter_selected 3. also simple snippets of code always is appreciated (No one wants to reinvent the wheel) :) Thanx Bob _ Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: newbie alternate row colours in dynamic table
Hiya I have a dynamic table and am trying to get the rows to be two different alternate colours. well Ive looked at a couple of snippets of this colour code and previous mails regarding this. Im having major troubles intergrating any of these suggestions with my code. Can anyone suggest where I am going wrong. Main problems are 1. where to put the loop for changing the colour (complicated due to the loop retrieving data from db)i.e in the do loopin the while loop? 2. Also how to echo my rows in the colours.(something like this I think) print tr bgcolor='$trcolor'$db_fetch['bugid']; ?/td; e.g here is the code snippet for alternate coloured rows $trcolor=#F0F8FF; while ($myrow = mysql_fetch_array($result)){ $colorset=0; if ($trcolor=='#F0F8FF'){ $trcolor='#B0C4DE'; $colorset=1; } if ($colorset==0){ if ($trcolor=='#B0C4DE'){ $trcolor='#F0F8FF';} } print tr bgcolor='$trcolor'; } I have included my table file. Any suggestions would be great (even further suggestions of code snippets I can look at) thanx here is my table.: ? require_once('db_api.php'); db_connect(); $querystring= SELECT * FROM bug; $db_result = mysql_query($querystring) or die(mysql_error()); $db_fetch = mysql_fetch_assoc($db_result); $db_totalrows = mysql_num_rows($db_result); //echo $db_totalrows; ? html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#FF text=#00 pnbsp;/p table border=2 cellspacing=2 bgcolor=#FF tr td colspan=9 bgcolor=#FFnbsp;/td /tr tr td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifbugid/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifstatus/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifseverity/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifsummary/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifdescription/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifdate_opened/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifestimation_completion/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifrelated_file/font/td td bordercolor=#99font size=-1 face=Verdana, Arial, Helvetica, sans-serifcreated_by/font/td /tr ? do { ? td? echo $db_fetch['bugid']; ?/td td? echo $db_fetch['status']; ?/td td? echo $db_fetch['severity']; ?/td td? echo $db_fetch['summary']; ?/td td? echo $db_fetch['description']; ?/td td? echo $db_fetch['date_opened']; ?/td td? echo $db_fetch['estimated_completion']; ?/td td? echo $db_fetch['related_file']; ?/td td? echo $db_fetch['created_by']; ?/td tr ? } while ($db_fetch = mysql_fetch_assoc($db_result)); ? td colspan=9 bgcolor=#FFnbsp;/td /table pnbsp;/p pnbsp;/p /body /html ? mysql_free_result($db_result); ? _ Overloaded with spam? With MSN 8, you can filter it out http://join.msn.com/?page=features/junkmailpgmarket=en-gbXAPID=32DI=1059 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: newbie alternate row colours in dynamic table
Hiya people After a lot of soul searching, exploring the web and help from many people I came up with this simple solution: Thank you Chris for explaining the toggle $colorset. In the end I decided this made life alot simplier. (clearly the brackets have to be correctly aligned) while( $row = mysql_fetch_array($db_result) ) { echo( tr $c td . $row['bugid'] . /td /tr ); if ( !isset($c) ) { $c = bgcolor=#FF; echo $c; } else { unset($c); } } From: Chris Hayes [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP] RE: newbie alternate row colours in dynamic table Date: Sat, 05 Apr 2003 22:32:17 +0200 At 22:14 5-4-2003, you wrote: Hiya I have a dynamic table and am trying to get the rows to be two different alternate colours. well Ive looked at a couple of snippets of this colour code and previous mails regarding this. Im having major troubles intergrating any of these suggestions with my code. Can anyone suggest where I am going wrong. Main problems are 1. where to put the loop for changing the colour (complicated due to the loop retrieving data from db)i.e in the do loopin the while loop? Within the loop that prints the rows, whcih is usually a while loop. But that depends on your preferences. 2. Also how to echo my rows in the colours.(something like this I think) print tr bgcolor='$trcolor'$db_fetch['bugid']; ?/td; e.g here is the code snippet for alternate coloured rows $trcolor=#F0F8FF; while ($myrow = mysql_fetch_array($result)){ $colorset=0; if ($trcolor=='#F0F8FF'){ $trcolor='#B0C4DE'; $colorset=1; } if ($colorset==0){ if ($trcolor=='#B0C4DE'){ $trcolor='#F0F8FF';} } print tr bgcolor='$trcolor'; } I see that you are using a helping variable $colorset. I have a problem reading your code in email, as i do not see hte indents well, so i restructure it here with _ underscores to make the indents survive the email program. $trcolor=#F0F8FF; //1 while ($myrow = mysql_fetch_array($result)) { ___$colorset=0; ___if ($trcolor=='#F0F8FF')//1 ___{$trcolor='#B0C4DE'; //2 $colorset=1; ___} ___if ($colorset==0) ___{ if ($trcolor=='#B0C4DE') //2 __{$trcolor='#F0F8FF'; //1 __} ___} print tr bgcolor='$trcolor'; } Lets walk through. In the 1st walk, 1a) you enter with color#1 and colorset=0. 2b) the first 'if' then sets it to color#2 and colorset=1 3c) The second if sees that both conditions are true and set the color back to color#1. So the first row prints color1. Ok. The code remembers the values, which are color#1 and colorset1. In the next walkthrough, 2a) the colorset is set to 0 to start with. At this moment you have the exact situation as with 1a). do you see that? it would be much easier to see what is happening if you would have only colorset toggling its value and just before printing, decide what the color is as a result of the value of colorset. Give it a try! Basically: $colorset=0; while () { toggle collorset (toggle: if 1 then 0 and opposite) if colorser=0 color=ff else color=a print color. } Chris Hayes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Surf together with new Shared Browsing http://join.msn.com/?page=features/browsepgmarket=en-gbXAPID=74DI=1059 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: newbie Dynamic Drop down lists using mysql
Hiya Im looking for any tutorials/snippets of code to show me how to code a dynamic drop down box/list in a php form. e.g a drop down menu of all current users (I assume this will need to connect to mysql db and select all usernames from table user and place in the menu. here what I have so far ? $connection = db_connect(); $querystring = (select username from user); $db_result = mysql_query($querystring); (if mysql_num_rows($db_result)) { while ($row = mysql_fetch_row($db_result)) { print(option value=\$row[0]\$row[0]/option); } } else { print(option value=\\No users created yet/option); } ? Any URLS will be much appreciated. Thanks Bob _ Express yourself with cool emoticons http://www.msn.co.uk/messenger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [newbie] embed php in html file
Hiya I need advice for an optimum solution to display the username that is logged in on every html form page of my application. I have a header.php : ? session_start(); echo BRfont face=\Verdana\font color=\red\size=\3\Logged in as: .$_SESSION['curr_user'].BR/fontbr; ? Now I have many html forms which user's see What I want to know is how to include the header.php into every html form page. One way is to rename the html file with extension .php then ? require_once(header.php) ? This seems a bit wasteful for one line of php to change all the forms to .php. Is there any other ways of embedding the header.php file in html forms.The reason I am so keen on keeping html and php files seperate is thus to make debugging easier and maintain a kinda three tier design. Any suggestions will be much appreciated Bob _ Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Newbie] Password()
Hi, in my code I am trying to send an email (containing a password) to a user when he has forgotten his password. The problem is that security leads to needing to encrypt passwords in the database. Im using the password function within mysql. Is there any way of reversing the password function() to get the original password to send out to the user? Or are there any other suggestions in PHP to reverse encryption of passwords. I do understand the principles of encryption and can see the point of unreversible functions but Im sure that not all applications re-set passwords with random generated ones but do send out forgotten passwords. Cheers B _ Worried what your kids see online? Protect them better with MSN 8 http://join.msn.com/?page=features/parentalpgmarket=en-gbXAPID=186DI=1059 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: (newbie)calling GLOBAL arrays
Hiya Im having difficulties calling array values from outside script. I have db.api.php ? session_start(); function db_fetch($querystring) { $db_result = mysql_query($querystring); $row = mysql_fetch_row($db_result); session_register('row'); $username = $row[0]; $password = $row[1]; $email = $row[2]; echo THE USERNAME IN DB.API IS $username; echo THE PASSWORD IN DB.API IS $password; echo THE EMAIL IN DB.API IS $email; } ? // this works fine but now when I try and call these variables from // another php script user.api.php ? session_start(); require_once(db_api.php); $querystring = (select username, password , email from user where username= '$username'); db_fetch($querystring); echo THE USERNAME IN USER API2 IS $row[0]; echo THE PASSWORD IN USER API IS $password; ? // I have tried to print to screen these variables from the //global array $row two different ways and seem to get nothing on screen // I have also tried registering the variables seperately such as session_register('username'); with no luck Can anyone see what I am doing wrong or suggest any tutorials which may describe using arrays with sessions. Thanks _ Worried what your kids see online? Protect them better with MSN 8 http://join.msn.com/?page=features/parentalpgmarket=en-gbXAPID=186DI=1059 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variable from webpage to php (newbie?)
Hiya It could need setting register_globals =on in your php.ini if after that still problems then you may need to look into sessions and in particular session_start() and $_SESSION['varname'] and make sure the variables are global so that more than one script can use them. Hope this steers you in right direction *warning im a newbie too so you may wait for some more replies to confirm what im saying* Bobster From: Joe Kupiszewski [EMAIL PROTECTED] Reply-To: Joe Kupiszewski [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP] Passing variable from webpage to php (newbie?) Date: Wed, 19 Mar 2003 10:57:11 -0500 I think I already tried to post once, so sorry if this is a duplicate, but I don't see my first attempt. I am trying to do what should be a relatively simple and basic task. I've got a php script/page that has a switch/case selection statement in it. Obviously, depending on what value a particular variable takes when passed to the script, the script SHOULD :) do different things. However, when I invoke the script using www.somedomain.com/somephpscript.php?action=1 (substitute one with, 2, 3, 4 or whatever) and then do a check whether any value is passed to my script, it always tells me the value is empty ( if (empty ($action)) - it just always thinks its empty. I'm copying this script from a book, so I do not have any reason to believe there is an error in the code, but obviously something is not happening properly. My thought is that perhaps something needs to be turned on in the php.ini or in the apache httpd.conf file to allow this variable passing to work. Is there some other way to do this? Sorry for the long paragraph sentence. I'll be happy to post the code if needed or provide any additional information or give the actual URL so you can see what is happening. Thanks for any thoughts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Overloaded with spam? With MSN 8, you can filter it out http://join.msn.com/?page=features/junkmailpgmarket=en-gbXAPID=32DI=1059 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: (newbie) how to redirect to html page from php
Hiya I have a login_screen.html which on submit is sent to login.php. Login.php does all the checking of usernames and passwords. I am trying to to produce this logic: //In login.php if password and username correct { go to main page } else { go back to login.screen.html echo Please try again; echo login Incorrect; I cannot seem to automatically go back to login_screen.html with the error message displayed in the else statment in login.php. Any suggestions? Thanks _ It's fast, it's easy and it's free. Get MSN Messenger today! http://messenger.msn.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: newbie OOP?
Hiya I am new to PHP and was wondering whether to develop small applications (20 pages ) is it worth it to use OOP? Can any recommend any books or URLS that explain Object orientated programming and design in detail. I have read articles in www.phpbuilder.com and www.phppatterns.com. In particular I am having troubles breaking my application design-wise, into classes and operations. Any suggestions and tips Cheers _ Stay in touch with MSN Messenger http://messenger.msn.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: traversing and displaying directories in html [newbie]
Hiya I am trying to find a way to drill down on html file names, if there are directories to display the files in the new directory. Im assuming this needs the calling of the same page which displayed the intial file names again with the argument of new directory. Does anyone have any tips for me. I can establish whether a file is an dir or not using is_dir...just not sure how to pass this new directory name and concatenate with the existing path to now show the file names in the new drill down directory. (Also Im not sure if my a href statements are correct and wanted to know any good tutorials on string expressions? So far I have knocked up this : $start_dir = C:/Program Files/ApacheGroup/Apache2/cgi-bin/; //default starting directory if ($new_dir ==0) //if new_dir is not set display files from start_dir { $current_dir = $start_dir; } else { $current_dir = $start_dir.$new_dir; //if new_dir is set than the current directory becomes //the starting directory and the new directory selected } $inside_dir = opendir($current_dir); //store contents of the file names in the current directory in $inside_dir echo Upload directory is $current_dirbr; echo Directory Listing:brhrbr; while ($file = readdir($inside_dir)) if (is_dir($file)) { echo a href=\displaydir.phpfile= .$file.\.$file./abr; } else { echo a href=\openfile.php? file=.$file.\.$file./abr; } closedir($inside_dir); _ It's fast, it's easy and it's free. Get MSN Messenger today! http://messenger.msn.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php