[PHP] Passing Arrays between pages
Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo ""; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan.
Re: [PHP] Passing Arrays between pages
Thanks for all your help!!! managed it with - $testArray = implode('|', $testArray); On next page: $testArray = explode('|', $testArray); - Original Message - From: <[EMAIL PROTECTED]> To: "PartyPosters" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, March 22, 2005 10:06 PM Subject: Re: [PHP] Passing Arrays between pages > 1. you can put your array in string using implode() function and on next > page create the array back using explode() function. > $testArray = implode('|', $testArray); > # you will get: "Apple|Banana|Peach" > On next page: $testArray = explode('|', $testArray); > > 2. use serialize()/unserialize() functions > > For more info read manual. > > -afan > > PartyPosters wrote: > > >Hello, > >Please can someone tell me how you pass arrays between PHP pages. > >I have tried something like this and have tried many variations of this but > >nothing working yet ; > > > > > >Page 1 > >$testArray[0] =Apple; > >$testArray[1] =Banana; > >$testArray[2] =Peach; > > > >echo ""; > > > >Page2 > >echo $testArray[1]; > > > > > >On different variations of this I keep on getting 'Array' when I to return the variable on the second page > > > >Many Thanks. > >Kaan. > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Notice: Undefined offset: 3 in ..........
Hello, Please could someone tell me why I am getting (Notice: Undefined offset: 3 in ..) from using this code. for ($i=0; $i<=3; $i++){ mysql_query("INSERT INTO shipped(userID, productID, distID, username,ship_company, ship_add1,ship_add2) VALUES(1, '$productID','$v_distIDArray[$i]', userID, '$v_companyArray[$i]','$v_add1Array[$i]','$v_add2Array[$i]')"); } Thanks Kaan - Original Message - From: PartyPosters To: php-general@lists.php.net Sent: Tuesday, March 22, 2005 10:01 PM Subject: Passing Arrays between pages Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo ""; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan.
[PHP] Converting to a string
Hello guys, i am using date("l dS of F Y h:i:s A") and want to put the value in a database as a string, How do I converting it to a string, this is what I have got so far:- $v_ship_date = date("l dS of F Y h:i:s A"); Lots of thanks. - Original Message - From: PartyPosters To: php-general@lists.php.net Sent: Tuesday, March 22, 2005 10:01 PM Subject: Passing Arrays between pages Hello, Please can someone tell me how you pass arrays between PHP pages. I have tried something like this and have tried many variations of this but nothing working yet ; Page 1 $testArray[0] =Apple; $testArray[1] =Banana; $testArray[2] =Peach; echo ""; Page2 echo $testArray[1]; On different variations of this I keep on getting 'Array' when I to return the variable on the second page Many Thanks. Kaan.
Re: [PHP] Converting to a string
Thanks guys, you were right - I needed to change the format of the field in the database. :D - Original Message - From: "Daniel Gerzo" <[EMAIL PROTECTED]> To: "PartyPosters" <[EMAIL PROTECTED]>; Sent: Wednesday, March 23, 2005 8:58 PM Subject: Re: [PHP] Converting to a string Hello PartyPosters, Wednesday, March 23, 2005, 9:43:30 PM, si odoslal: > Hello guys, > i am using date("l dS of F Y h:i:s A") and want to put the value in a database as a string, > How do I converting it to a string, this is what I have got so far:- > $v_ship_date = date("l dS of F Y h:i:s A"); well, php doesn't really cares if you got string or bool or integer like c or pascal does. php is converting automatically integers to strings and so far, you can add your value to the database whithout any manual converting... > Lots of thanks. -- Later +--==/\/\==--+ (__) FreeBSD | DanGer <[EMAIL PROTECTED]> |\\\'',) The | [EMAIL PROTECTED] ICQ261701668 | \/ \ ^Power | http://danger.rulez.sk | .\._/_)To +--==\/\/==--+ Serve [ Ved evidenciu o svojich udajoch, je to dokaz tvojej prace. ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending a Table Via mail
Hello is there any way I can send a table (or just tabulated data) via email. I've tried this but comes up with an error. $to = [EMAIL PROTECTED]; $re = "Test Email from system"; $msg = "hello" mail($to, $re, $msg); Thanks in advance.
Re: [PHP] Sending a Table Via mail
Great thanks! Sorry I didn't realise it was in there. what I've got so far is the following, I want to include a variable in there but have tried different combos but can't get it to work reading the variable. $to = [EMAIL PROTECTED] # subject of message $re = "Test Email from system"; $tablecontent = "http://www.w3.org/TR/html4/loose.dtd'>Untitled Documenthello"; #message from the form $msg = $tablecontent; $message = ' Birthday Reminders for August Here are the birthdays upcoming in August! PersonDayMonthYear Joe3rdAugust1970 "$username" '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; # send the mail now mail($to, $re, $message,$headers); ### MAIL ENDS HERE ?> - Original Message - From: "John Nichel" <[EMAIL PROTECTED]> To: Sent: Wednesday, March 23, 2005 9:37 PM Subject: Re: [PHP] Sending a Table Via mail > PartyPosters wrote: > > Hello is there any way I can send a table (or just tabulated data) via email. > > I've tried this but comes up with an error. > > $to = [EMAIL PROTECTED]; > > > > $re = "Test Email from system"; > > > > $msg = "hello" > > > > > > mail($to, $re, $msg); > > It's in the manual... > > http://us4.php.net/manual/en/function.mail.php > > -- > John C. Nichel > ÜberGeek > KegWorks.com > 716.856.9675 > [EMAIL PROTECTED] > > -- > 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] Simple Alert Message then Redirect?
Hello I want to display an alert message then after users click ok I want to automatically goto a URL if ($var_stock_count == 0){ alert("Message") redirect("http://www.google.co.uk";); } Can someone help me put this right. Thanks Kaan.
Re: [PHP] Simple Alert Message then Redirect?
Thanks for you reply. I need to be able to test the php variable though, is the anyway I can call the java funtion from my if statement? - Original Message - From: "Josip Dzolonga" <[EMAIL PROTECTED]> To: "PartyPosters" <[EMAIL PROTECTED]> Cc: Sent: Thursday, April 07, 2005 6:55 PM Subject: Re: [PHP] Simple Alert Message then Redirect? > PartyPosters wrote: > > >Hello I want to display an alert message then after users click ok I want to automatically goto a URL > > > >if ($var_stock_count == 0){ > >alert("Message") > > redirect("http://www.google.co.uk";); > > > >} > > > > This should be done with JavaScript, not PHP, so something like : > > > alert("Message"); > window.location = "<a href="http://www.google.com"">http://www.google.com"</a>;; > > > should do the work ;-). > > Hope this helps, > > -- > Josip Dzolonga > http://josip.dotgeek.org > > jdzolonga[at]gmail.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and javascript
Hello, I have a form that when I hit sumbit I want to test the varialble in javascript. I can get it working using test variables in php but I want to be able to call the input box in my form, the only problem is the name of the box is in an array (i think) as it's in a list. You can see the 2 samples of the code below which will hopefully make more sence. Can anyone help me out? Thanks. function checkdata() { alert(document.Selection.quantity[0].value) alert("TEST") return true } --- while ($row=mysql_fetch_array($mysql_result)) { echo " "; }
[PHP] Simple Problem
I can't figure out what I am doing wrong, this sql string seems to filter out the information I want but it duplicates the all info, as 'num_rows' is total of rows in the table and not the correct value of the filtered information? $sql="SELECT products.productID, products.title, products.number_per_box, products.stock_level, products.image, users.username, users.email, users.userID FROM users, products WHERE products.userID = $userID"; $mysql_result=mysql_query($sql,$connection); $num_rows=mysql_num_rows($mysql_result); this is the old sql statement which works fine - $sql="SELECT productID, title, number_per_box, stock_level, image, userID FROM products WHERE userID = '$userID'"; $mysql_result=mysql_query($sql,$connection); $num_rows=mysql_num_rows($mysql_result); what I am I doing wrong. Thanks Kaan.
[PHP] Creating a Directory
Hello, I am using the following script to upload files to my server. Is there anyway I can create a directory (on the fly) for the new image to go, as I want people to be able to upload files with the same name. Thanks $uploadDir = 'uploads/'; $uploadFile = $uploadDir . $_FILES['form_data']['name']; print ""; if (move_uploaded_file($_FILES['form_data']['tmp_name'], $uploadFile)) { print "File is valid, and was successfully uploaded. "; # print "Here's some more debugging info:\n"; #print_r($_FILES); } else { print "File is invalid. "; # print "Possible file upload attack! Here's some debugging info:\n"; # print_r($_FILES); } print "";
[PHP] Insert Chars into a string
Hello, I have a variable that contains a filename, I want to be able to insert the date and time just before for the ".jpg" for example if my filename is 'pic.jpg' I want it to read 'pic_Monday 15th of January 2003 05:51:38 AM.jpg (or if anyone else knowshow to write the time and time all in numbers it would be appreciated as I'm using ate("l dS of F Y h:i:s A") which obviously is a bit long. Many thanks. Kaan