Thomas Rozanov Posted March 16, 2011 Report Posted March 16, 2011 During the process of learning PHP (which I have ) I came up with a couple of questions. Maybe some PHP experts could answer them. 1) You know how you put } or { after each statement I think. What's the rule for that? What do they do ? Which side do i put? { or } ? 2)How do I make a website url a variable? however I want one part of the website to be able to change (text-box) . Like ex. $example= http://twitter.com/recessionwire but i want the recessionwire part to be changable when someone types in text box. Thanks Guys! Quote
Tom Posted March 16, 2011 Report Posted March 16, 2011 if($condition){ // Do things } for the second you need a form somewhere, and in the appropriate module it's sent to $url = 'http://www.twitter.com/'; $post = $this->post->input: $twitter = $url.$post; where your input field is named input. Quote
Thomas Rozanov Posted March 16, 2011 Author Report Posted March 16, 2011 if($condition){ // Do things } for the second you need a form somewhere, and in the appropriate module it's sent to $url = 'http://www.twitter.com/'; $post = $this->post->input: $twitter = $url.$post; where your input field is named input. Thanks A Lot Tom! Could you explain number one more clearly please. I don't get it honestly. And for # 2 http://mpmap02.flightgear.org/?pilots_filter_callsign=example I need this site. So the example part is what i need to change. : $url = 'http://mpmap02.flightgear.org/?pilots_filter_callsign='; $post = $this->post->input: $input = $url.$post; Quote
Nuclear Posted March 16, 2011 Report Posted March 16, 2011 The { and } (curly brackets) are used to contain statement blocks. You don't need to put one after every statement. They are used for blocks of statements which are grouped together. For example: if ($x==1) { statement 1; statement 2; statement 3; } statement 4; In this example, if $x=1, then statements 1-3 will be executed, otherwise it will skip that block and continue with statement 4. Quote
Thomas Rozanov Posted March 16, 2011 Author Report Posted March 16, 2011 I kind of get it but still not confident :S Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.