[PHP] Variables not working
Hello all, im not sure if its my installation or if on doing something wrong but i cant seem to use any of the variables from forms that i PUT to. Or any full stop! even doesnt out put anything. Anyone seen this before? thanks in advance for your help Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working
Um ok i can understand that this can be unsecure, how do i pass html variables to php witout the use of globals? Cheers baldey_uk -Original Message- From: Nathan [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 02:34 To: Rasmus Lerdorf; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Variables not working Before you get carried away with registering globals, try echoing: $_SERVER["HTTP_USER_AGENT"]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS["HTTP_USER_AGENT"]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "baldey_uk" <> Cc: <> Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: > Hello all, im not sure if its my installation or if on doing something wrong > but i cant seem to use any of the variables from forms that i PUT to. Or any > full stop! even > > > > doesnt out put anything. Anyone seen this before? > thanks in advance for your help > > > Cheers From > > baldey_uk > > > > -- > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working
Sorry let me rephrase that ' can anyone point me to good docs about passing variables between html and php' please? Cheers baldey_uk -Original Message- From: Nathan [mailto:[EMAIL PROTECTED]] Sent: 27 April 2002 02:34 To: Rasmus Lerdorf; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Variables not working Before you get carried away with registering globals, try echoing: $_SERVER["HTTP_USER_AGENT"]; Or, for versions prior to 4.1.X, change that to: $HTTP_SERVER_VARS["HTTP_USER_AGENT"]; Registering globals is insecure unless you are VERY careful about how every variable you have is defined... Cheers, # Nathan - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "baldey_uk" <> Cc: <> Sent: Friday, April 26, 2002 6:41 PM Subject: Re: [PHP] Variables not working Turn on register_globals in your php.ini file. On Sat, 27 Apr 2002, baldey_uk wrote: > Hello all, im not sure if its my installation or if on doing something wrong > but i cant seem to use any of the variables from forms that i PUT to. Or any > full stop! even > > > > doesnt out put anything. Anyone seen this before? > thanks in advance for your help > > > Cheers From > > baldey_uk > > > > -- > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Another silly email
Um im trying to take the input from a txt field in an html form (which happens to be a number) and convert it to currency. Anyone know if there is a function in PHP to do this or do i have to convert to a float etc? Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] failed query results
Hello all, i am trying to query a mysql database to see if a customer all ready exists in a database and if so then use there customer id to insert data into another table. Can anyone tell me what valuse mysql returns if the query returns no value? i have the following code: $customer_id_check=("SELECT id FROM $customer_table WHERE firstname = '$firstname' && lastname = '$lastname' && email = '$email'"); $result1=mysql_query($customer_id_check); if (!$result1) { print "theres no such customer!"; } which i thought should echo 'theres no such customer!' if a customer didnt exist who fitted the query, however it doesnt and if i echo $result1 i get 'Resource id #2 not what i was expecting (was more expecting something along the lines of NULL). Thanks for any help in advance!!! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date and Time
Hi all, Anyone know any reason that the date function would return 2am in the morning as 102 if i use it in the following manner? $time=date("H:i:s"); print $time; this outputs 102:14:51 instead of 02:14:51, anyone know where the 1 comes from? and why its there? Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] keymappings - PHP or MySQL?
Hi, At the moment im getting a difference in keymappings between what is typed into a field and what is stored in the database. I have an html form that gets a text string called $email and this is inserted into a VARCHAR database feild via php, the problem is when special characters are included in the email address. For example [EMAIL PROTECTED] gets stored in the database as baldey\[EMAIL PROTECTED] Has anyone seen this before? Is this a PHP or mysql issue? Do i have to set special options to use a UK keymap or something like that? If anyone has any links to docs that deal with this sort of thing i'd really appreciate them!! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] keymappings - PHP or MySQL?
Hi, At the moment im getting a difference in keymappings between what is typed into a field and what is stored in the database. I have an html form that gets a text string called $email and this is inserted into a VARCHAR database feild via php, the problem is when special characters are included in the email address. For example [EMAIL PROTECTED] gets stored in the database as baldey\[EMAIL PROTECTED] Has anyone seen this before? Is this a PHP or mysql issue? Do i have to set special options to use a UK keymap or something like that? If anyone has any links to docs that deal with this sort of thing i'd really appreciate them!! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] keymappings - PHP or MySQL?
Thanks for the suggestion Miguel, i tried it and got a result of 95 on both tests which is the underscore character. bizare Cheers Baldey_uk -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: 29 April 2002 05:27 To: baldey_uk Cc: Php-General Subject: Re: [PHP] keymappings - PHP or MySQL? On Mon, 29 Apr 2002, baldey_uk wrote: > At the moment im getting a difference in keymappings between what is typed > into a field and what is stored in the database. I have an html form that > gets a text string called $email and this is inserted into a VARCHAR > database feild via php, the problem is when special characters are included > in the email address. For example [EMAIL PROTECTED] gets stored in the > database as baldey\[EMAIL PROTECTED] Has anyone seen this before? Is this a > PHP or mysql issue? Do i have to set special options to use a UK keymap or > something like that? If anyone has any links to docs that deal with this > sort of thing i'd really appreciate them!! You might want to do some detective work to hone in on what's really going on. Before storing the string into the database, print out the actual numeric code for each character by looping over the string with ord(). Then do the same when you pull the data out of the database. Hopefully that'll help narrow down where this is happening. miguel -- 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] If statement leading to another php page
Hello all, How can i force a transfer to another php page from an if statement? I have been trying: if (condition){ echo "Link"; } else { something else } without much luck, i keep getting parse errors. Thanks for anyhelp in advance! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variables between php forms
Hi sorry to annoy you AGAIN, but i cant seem to get it working i think its something to do with the order that i put things in: #end of html and start of php script '; ?>php # end of php script back into html Are your details correct? If i put the echo or INPUT type outside of the php script this works, but obviously just returns a string '.$quantity.' and not waht the variable $quantity holds. This is extremely confusing. How do i get this php variable to be passed to the HTML so it can be posted I thought the way i have it the echo would make the variable testvar available to the browser, and then i would be able to retrieve it by $_POST[testvar]; or $_POST[$testvar]; in either the confirm.php or updateaddress.php that the html posts to? Yet again thanks in advance for any help. Confused Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using header ();
Hi all, Can someone tell me how to use the header function? Can i use it with relative URLs for example: header ("Location:index2.php"); If i have that line somewhere in my script will the browser be automatically taken there or do i have to echo it or something of the like? Thanks for any help in advance! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] using header ();
Yes i have tested it thats why i am asking, as it is not working either way for me, it just stays on the same screen but blanks the previous output to the page. Baldey_uk -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED]] Sent: 11 May 2002 12:07 To: Php-General Subject: Re: [PHP] using header (); -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then baldey_uk declared > Can someone tell me how to use the header function? Can i use it with > relative URLs for example: > > header ("Location:index2.php"); Have you tested it? Come on, took me all of a minute and a half to try it out :-) - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE83Ps5HpvrrTa6L5oRAlHPAJ0cAmrYVkoKlUir9pfGAsZZu8hD0QCfXA7+ tNRCFd2jt2VU5YQblmuJluM= =j0VL -END PGP SIGNATURE- -- 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
RE: [PHP] using header ();
Here ya go: Basically im trying to update details in a database, after the new details are put into a form they are printed to the screen with a 'are the details correct' scenario. From there if they click 'no' i want them to be put back to the updateaddress.php page but also pass two php variables back to that page for use later on. If they say yes i will do mysql query calls and update the database but also need to forward them to another php page and pass varaible values to that new page '; switch($_POST['choice']) { case "yes" : #somethin will happen here ; break; #if not we need to keep the customer_id and quantity and start again case "no" : echo ''; header("Location: updateaddress.php"); exit; } ?> Cheers Baldey_uk -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED]] Sent: 11 May 2002 12:15 To: PHP-General Subject: Re: [PHP] using header (); -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then baldey_uk declared > Yes i have tested it thats why i am asking, as it is not working either way > for me, it just stays on the same screen but blanks the previous output to > the page. Weird, works fine for me. Let's see the code. - -- Nick Wilson // www.tioka.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE83P06HpvrrTa6L5oRAg70AKCjl4NlTqVt0lBV9TChHXOP5blMOwCeKpDW WDkFT7yFhGykBAozd0TKirY= =LI4h -END PGP SIGNATURE- -- 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] header problems
Hi all, Can anyone tell me if there is any reason why this would not be working? mysql_connect($DBhost,$DBuser,$DBpass) or die(header("Location: error.php")); What im trying to do is connect to the database and if that fails send the browser to the error page. But the browser just sits there on the page that fails to connect Thanks for any advice/help in advance Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] version differences
Hi all, Can anyone tell me whether or not the sprintf function existed in php 4.12? I have the following line: $order_value=sprintf('%.2f', floatval($quantity)*7.0); Which works at home on my version 4.2 of php but whne i upload to the server running 4.12 the script just seems to stop there and go no further? Any help, advice or pointing to relevant docs would be greatly appreciated. Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php