Re: [PHP] Problem with variables
Fernando A soporteallpurp...@gmail.com wrote: I am working with php and codeigniter, but I have not yet experienced. I need create a variable that is available throughout system. This variable contains the number of company and can change. as I can handle this? Hi, Fernando, welcome. I'm just a little unsure what you mean by number of company -- is this a count, as in 10 companies, or is it a phone number, or is it something else? Jim's reply is workable -- storing session values is quite useful, but sessions are tied to a specific browser client/ip, and I'm not sure that's what you want/need here. If you are looking for setting a global variable that will be available everywhere in your application, you can use $GLOBALS, or set it from the very top level context of the application. Given you're using CodeIgniter, which sadly I am not versed in, you may need to set it with $GLOBALS: $GLOBALS['my_var'] = 10; // whatever you need to do here When you say it changes, how and when exactly does it change? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with variables
Hello, I am working with php and codeigniter, but I have not yet experienced. I need create a variable that is available throughout system. This variable contains the number of company and can change. as I can handle this? Thank you, very much! Ferd
Re: [PHP] problem retrieving variables.
Paul Halliday wrote: I think I just might be missing the logic here. I have a page that is created and within this page, I include an iframe like this: $qp = urlencode($when $wFilter $aFilter); echo \rtrtd id=links colspan=2 style=\display:none; padding-left: 12px;\ \rIFRAME id=\links-frame\ name=\links-frame\ src=\edv.php?qp=$qp\ width=100% height=1000 frameborder=0 scrolling=no/IFRAME \r/td \r/tr; When I call edv.php though, I can't $qp = $_REQUEST['qp']; What am I missing? Thanks. Just below your urlencode() call in the parent script place echo $qp; to see if the value is what you expect? Then within edv.php add this var_dump($_REQUEST); and see if $_REQUEST['qp'] is there, and what it is. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem retrieving variables.
On Thu, Sep 2, 2010 at 5:43 PM, Jim Lucas li...@cmsws.com wrote: Paul Halliday wrote: I think I just might be missing the logic here. I have a page that is created and within this page, I include an iframe like this: $qp = urlencode($when $wFilter $aFilter); echo \rtrtd id=links colspan=2 style=\display:none; padding-left: 12px;\ \rIFRAME id=\links-frame\ name=\links-frame\ src=\edv.php?qp=$qp\ width=100% height=1000 frameborder=0 scrolling=no/IFRAME \r/td \r/tr; When I call edv.php though, I can't $qp = $_REQUEST['qp']; What am I missing? Thanks. Just below your urlencode() call in the parent script place echo $qp; to see if the value is what you expect? Then within edv.php add this var_dump($_REQUEST); and see if $_REQUEST['qp'] is there, and what it is. Jim I think I see what I am doing wrong.. ... createlink function up here then... ?php $qp = $_REQUEST['qp'];? html body form id=edv method=post action=edv.php table width=100% border=0 cellpadding=1 cellspacing=0trtd align=left input onMouseOver=style.backgroundColor='#ff'; onMouseOut=style.backgroundColor='#DD'; id=links name=links type=submit value=create link graph style=font-size: 9px; border: none; border: .5pt solid #00; background:#DD; /td ?php echo $qp; if ($_REQUEST['links']) { CreateLink($qp); } ? /form /body /html I can't do what I am trying to do. Do I need to put it in a hidden field within the form and then re-request? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem sending variables with forms
I have a problem that i cant send variable over a form. Because of that when i watn to echo the variable next page an error occured...i use redhat 9.0, apache 2 and php 4.3.4. Please help me Abdullah Teke _ Telephone : +90 555 337 21 89 Messenger : [EMAIL PROTECTED] Web: http://abdullahteke.cjb.net Icq : 164500674
RE: [PHP] problem sending variables with forms
Some code samples would be really helpful. You also said an error occurred but failed to mention any details about that error. That aside, I'll make a guess at some possible problems: 1) You're trying at access the wrong super global (e.g. GET when you should be looking for POST). 2) You're trying to access the variable directly but do not have register_globals enabled. 3) You're spelling something wrong (we all do it from time to time). -M -Original Message- From: Abdullah Teke [mailto:[EMAIL PROTECTED] Sent: Thursday, December 25, 2003 8:55 AM To: [EMAIL PROTECTED] Subject: [PHP] problem sending variables with forms I have a problem that i cant send variable over a form. Because of that when i watn to echo the variable next page an error occured...i use redhat 9.0, apache 2 and php 4.3.4. Please help me Abdullah Teke _ Telephone : +90 555 337 21 89 Messenger : [EMAIL PROTECTED] Web: http://abdullahteke.cjb.net Icq : 164500674 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem setting variables.
//Find User Configuration $sql = mysql_query(SELECT field_name FROM config WHERE show_field=1) OR die(Could not query database: .mysql_error().); while($result = mysql_fetch_array($sql, MYSQL_ASSOC)){ $field_name_array[] = $result['field_name'] } // Iterate through array and print fields if($field_name_array == ){ print 'please select at least 1 field to be shown'; } else { for($i=0, $n=sizeof($field_name_array); $i$n; $i++){ print $field_name_array[$i]; } } -Original Message- From: Jason Martyn [mailto:[EMAIL PROTECTED] Sent: Sunday, July 27, 2003 9:22 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem setting variables. I'm creating a script that filters the table of results from a database based on the configuration set by the user (config stored in database as well). For example a table has 30 columns. However the user need only see 5. Every user is different so a user configuration is stored in the database. The database has 2 columns: field_name and show_field. field_name is the name of the field (obviously) that is shown in the table. show_field can either be a 1 or a 0. 1 = show field. 0 = don't show field. I'm getting to a certain point. But I'm not sure how I can go about setting variables for each field_name that has a show_field value of 1. Heres the code. ?php function Interactive() { //Database Variables include ( include/db_config.inc ); //Database connection. $connect = mysql_connect($host, $login, $passwd) OR die(Could not connect to MySQL Database: .mysql_error().); mysql_select_db(admin, $connect) OR die(Could not select Database: .mysql_error().); //Find User Configuration $sql = mysql_query(SELECT field_name FROM config WHERE show_field=1) OR die(Could not query database: .mysql_error().); $result = mysql_fetch_array($sql, MYSQL_ASSOC); //Make sure there are fields to be shown. if(count($result) 0) { //*// // Here is where I would like to set variables. // I first thought of using a for statement, but // realized that variables cannot begin with a // number. Is there any possible way to set // variables for the array results of my query? //*// } else { die(Please select at least 1 field to be shown.); } } ? Thanks, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem setting variables - Correction
Correction...Forgot a ; //Find User Configuration $sql = mysql_query(SELECT field_name FROM config WHERE show_field=1) OR die(Could not query database: .mysql_error().); while($result = mysql_fetch_array($sql, MYSQL_ASSOC)){ $field_name_array[] = $result['field_name']; } // Iterate through array and print fields if($field_name_array == ){ print 'please select at least 1 field to be shown'; } else { for($i=0, $n=sizeof($field_name_array); $i$n; $i++){ print $field_name_array[$i]; } } -Original Message- From: Ralph Guzman [mailto:[EMAIL PROTECTED] Sent: Monday, July 28, 2003 4:24 AM To: 'Jason Martyn'; [EMAIL PROTECTED] Subject: RE: [PHP] Problem setting variables. //Find User Configuration $sql = mysql_query(SELECT field_name FROM config WHERE show_field=1) OR die(Could not query database: .mysql_error().); while($result = mysql_fetch_array($sql, MYSQL_ASSOC)){ $field_name_array[] = $result['field_name'] } // Iterate through array and print fields if($field_name_array == ){ print 'please select at least 1 field to be shown'; } else { for($i=0, $n=sizeof($field_name_array); $i$n; $i++){ print $field_name_array[$i]; } } -Original Message- From: Jason Martyn [mailto:[EMAIL PROTECTED] Sent: Sunday, July 27, 2003 9:22 PM To: [EMAIL PROTECTED] Subject: [PHP] Problem setting variables. I'm creating a script that filters the table of results from a database based on the configuration set by the user (config stored in database as well). For example a table has 30 columns. However the user need only see 5. Every user is different so a user configuration is stored in the database. The database has 2 columns: field_name and show_field. field_name is the name of the field (obviously) that is shown in the table. show_field can either be a 1 or a 0. 1 = show field. 0 = don't show field. I'm getting to a certain point. But I'm not sure how I can go about setting variables for each field_name that has a show_field value of 1. Heres the code. ?php function Interactive() { //Database Variables include ( include/db_config.inc ); //Database connection. $connect = mysql_connect($host, $login, $passwd) OR die(Could not connect to MySQL Database: .mysql_error().); mysql_select_db(admin, $connect) OR die(Could not select Database: .mysql_error().); //Find User Configuration $sql = mysql_query(SELECT field_name FROM config WHERE show_field=1) OR die(Could not query database: .mysql_error().); $result = mysql_fetch_array($sql, MYSQL_ASSOC); //Make sure there are fields to be shown. if(count($result) 0) { //*// // Here is where I would like to set variables. // I first thought of using a for statement, but // realized that variables cannot begin with a // number. Is there any possible way to set // variables for the array results of my query? //*// } else { die(Please select at least 1 field to be shown.); } } ? Thanks, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem setting variables.
I'm creating a script that filters the table of results from a database based on the configuration set by the user (config stored in database as well). For example a table has 30 columns. However the user need only see 5. Every user is different so a user configuration is stored in the database. The database has 2 columns: field_name and show_field. field_name is the name of the field (obviously) that is shown in the table. show_field can either be a 1 or a 0. 1 = show field. 0 = don't show field. I'm getting to a certain point. But I'm not sure how I can go about setting variables for each field_name that has a show_field value of 1. Heres the code. ?php function Interactive() { //Database Variables include ( include/db_config.inc ); //Database connection. $connect = mysql_connect($host, $login, $passwd) OR die(Could not connect to MySQL Database: .mysql_error().); mysql_select_db(admin, $connect) OR die(Could not select Database: .mysql_error().); //Find User Configuration $sql = mysql_query(SELECT field_name FROM config WHERE show_field=1) OR die(Could not query database: .mysql_error().); $result = mysql_fetch_array($sql, MYSQL_ASSOC); //Make sure there are fields to be shown. if(count($result) 0) { //*// // Here is where I would like to set variables. // I first thought of using a for statement, but // realized that variables cannot begin with a // number. Is there any possible way to set // variables for the array results of my query? //*// } else { die(Please select at least 1 field to be shown.); } } ? Thanks, Jason
[PHP] Problem with VARIABLES
I have this page where I am printing some items that are defined by size and color which all the info is pulled from a database. in the first item loop PRINT ("tdinput type=\"text\" name=\"$Color$Temp[$f]\" size=\"3\"/td\n"); translated looks like this. tdinput type="text" name=\"WhiteS" size="3"/td meaning the color white and the size Small. Now the next loop does what it is suppose to and returns a value of tdinput type="text" name=\"BlackS" size="3"/td These get posted to the next page. Now for the PROBLEM without hard coding it how can I get the value of BlackS meaning I know the color and sizes but how do I put the variable together to print the value of it. On the 2nd page I would like to echo $Color$Temp[$f] but that does not return the value of the item. I need $Color$Temp[$f] to turn into the variable not a value. So I can echo the variable. Someone please help. (*NOTE* the reason I do not want to hard code it is that I have a list of 102 colors which makes for a really long script.) PLEASE CC ME ON THE MESSAGE BECAUSE I AM ONLY SUBSCRIBED TO THE DIGEST (I will have to wait some 12 odd hours for the answer) Regards, Ian LeBlanc Web Development Rask, Inc. - www.rask.com Phone: (727) 517-2000 Fax: (727) 517-2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem with VARIABLES
Ian, I think what you want is a variable variable - have a look at http://www.php.net/manual/en/html/language.variables.variable.html I think you might want something like this: ${$Color$Temp[$f]} HTH. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com Ian LeBlanc [[EMAIL PROTECTED]] wrote: I have this page where I am printing some items that are defined by size and color which all the info is pulled from a database. in the first item loop PRINT ("tdinput type=\"text\" name=\"$Color$Temp[$f]\" size=\"3\"/td\n"); translated looks like this. tdinput type="text" name=\"WhiteS" size="3"/td meaning the color white and the size Small. Now the next loop does what it is suppose to and returns a value of tdinput type="text" name=\"BlackS" size="3"/td These get posted to the next page. Now for the PROBLEM without hard coding it how can I get the value of BlackS meaning I know the color and sizes but how do I put the variable together to print the value of it. On the 2nd page I would like to echo $Color$Temp[$f] but that does not return the value of the item. I need $Color$Temp[$f] to turn into the variable not a value. So I can echo the variable. Someone please help. (*NOTE* the reason I do not want to hard code it is that I have a list of 102 colors which makes for a really long script.) PLEASE CC ME ON THE MESSAGE BECAUSE I AM ONLY SUBSCRIBED TO THE DIGEST (I will have to wait some 12 odd hours for the answer) Regards, Ian LeBlanc Web Development Rask, Inc. - www.rask.com Phone: (727) 517-2000 Fax: (727) 517-2001 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]