Cheers
Everything is working as it should :)
ty so much. I really appreciate your patience and help.
Loz...
User Profile
Collapse
-
I took your great advice and simplified the code :) Yay it works........
one small question. This is returned:
Exchange Rates USD
GBP - 0.552272
USD - 1
NZD - 1.48695
10 US Dollars buys you:
NZD - 5.52272
NZD - 10.00000
NZD - 14.86950
I have tried putting in $key to show currency type but it is taking last value and applying it to all.
...Leave a comment:
-
I have reread the manual.
...Code:/*example 1 - Basic loop thru assoc array*/ foreach($aExchangeRates as $key => $value) { echo $key . " - ". $value . "<br>"; } /*example 2 - looping values and passing thru function*/ foreach($aExchangeRates as $value) { echo get_currency($money, $value). "<br>"; }Leave a comment:
-
Thats correct. Have tried
but get this error messageCode:foreach($aExchangeRates as $key => $value) { echo get_currency($money, $iExchangeRate). "<br>"; }
Notice: Undefined variable: iExchangeRate in C:\Program Files\Apache\ht docs\currency2. php on line 37
$14.86950
...Code:Line 37 is echo get_currency($money, $iExchangeRate). "<br>";
Leave a comment:
-
Tyvm :)
I decleared the array outside of the function and then decleared a global var inside the function. Not sure if this is the best wat to do it but it works.
I have the Foreach loop working well but am having trouble calling and executing the function in the Foreach loop.
Goal:
Loop through array and apply function to the values and then output the result.
...Code:foreach($aExchangeRates
Leave a comment:
-
Sorry I made a mistake with this reply and don't know how to delete it :)Leave a comment:
-
Associative array within fuction
Hi
I could really do with some help here :)
I am tring to display all of the results from the array without having to write everything out by hand like this
I have been trying to...Code:echo get_currency(1, GBP); echo "<br>"; echo get_currency(1, USD); echo "<br>"; echo get_currency(2, NZD); echo "<br>";
-
It works :)
Thank you so much for being so patient and encouraging. I have spent the last day or so making sure that I completely understand the logic behind everything. I have learnt so much from you. I truly appreciate your help!
I will take your advice and not post again until I have gone through the w3schools page again (and again) and have managed to link up all of the concepts.
I have searched for...Leave a comment:
-
I did this and am passing the correct values through from the results page
However to do my "for each" loop and substr($ChildID , 0, -1); I need to work out the name of the array. When I have looked at examples of this online they also included the name of the array. Oh well my...Code:Array ( [BGD-162510-xxxx_] => 1 [BGD-162510-xxxx_] => 1 [BGD-169620-xxxx_] => 0 )
Leave a comment:
-
What we do is that we don't go through govt or NGOs. Usually if you do that the money never gets to the right people. We ask the community what they need and get them to elect their own representatives and have support offices for the community in the country that are constantly involved in the community as appropriate. We also do other things like trying to end bonded labour and child exploitation etc.
thats my rant :)
...Leave a comment:
-
Yep - the place I work for raises money to help communities, especially children, in India, Bangladesh and Africa....Leave a comment:
-
Thats awesome
Array
(
[BGD-162510-xxxx_] => 1
[BGD-162510-xxxx_] => 1
[BGD-169620-xxxx_] => 0
)
Exactly what I wanted to pass through. soon as I get this insert to work I promise I will go through all of the w3s pages before I post on this site again (Can you hear the collective rejoicing of all the experts)
I tried to use "foreach loop",...Leave a comment:
-
Harpreet :)
PS: From the title (PHP Tutorial) you are using, I guess this is an assignment! Is it? If thats the case, then its better for you if you do it yourself rather than asking here in TheScripts.[/QUOTE]
FYI - I am absolutely not doing this as part of a course for School. Honestly this is for my own personal development tyvm Loz :)Leave a comment:
-
am VERY sorry to waste everyones time
I have gone through the links.
1) I have place a standard radio button to test the syntax etc. I have been able to pass test values through the page which will insert new value into db (childf.php)
Question
What is the syntax for passing the value for the radio buttons populated by the query to the database.
[code=php]
echo "<input...Leave a comment:
-
Set up third page (of course) and have insert query ready to go.
Form on childc.php
goes to childf.phpCode:<FORM ACTION="childf.php" METHOD="POST"> <input type="submit" name="IsSponsored[]" value="Submit" /> </FORM>
...Code:<?php $db = mysql_connect('localhost', 'xxx', 'xxx');Leave a comment:
-
lol - of course I do. I'm just getting a bit ahead of myself. Didn't think that one through.
I'll get back to it then.
tyvm...Leave a comment:
-
Just to be clear
1)childa.php
User submits query
2)childc.php
returns results
3)User then changes data displayed in radio button e.g. from "Not_Sponso red" to "Sponsored"
4)User selects submit button
5)db is updated with new value
so
[code=php]
/*Your comment*/
/*<form action="abc.php ">*/
<FORM ACTION="childa. php"...Leave a comment:
-
Hi Again :)
thanks for the tip
did that but am not sure about syntax when parsing values from db
[code=php]
<FORM ACTION="childa. php" METHOD="POST">
<input type="submit" value="submit" />
</FORM>
<?php
$db = mysql_connect(' localhost', 'xxx', 'xxx');
mysql_select_db ("child",$db );...Leave a comment:
-
woo hoo
got radio buttons to change value.
Am trying to set up insert query now. If anyone would like to help out it would be really cool. Currently I am still trying to work out which value to parse :)
[code=php]
/*this box checked if IsSponsored = 1*/
echo "<input type=\"radio\" name=\"".$show['ChildID']." \" value=\"1\" ".$sponsore d[$show['IsSponsored']]."></input>Is...Leave a comment:
-
mistake here :( ---------------------------------------------------------Leave a comment:
No activity results to display
Show More
Leave a comment: