Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
You already have several other topics about this: http://www.phpfreaks.com/forums/index.php/topic,234564.0.html http://www.phpfreaks.com/forums/index.php/topic,234530.0.html http://www.phpfreaks.com/forums/index.php/topic,234559.0.html
-
That is an ajax api [...] There is no reason why PHP couldn't call the API. You'll just need to check the JS code they provide and find out the URL to the API. Then you can do like this: <?php function translate($textSource, $langSource, $langTarget) { $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=' . urlencode($textSource) . '&langpair=' . urlencode($langSource . '|' . $langTarget), CURLOPT_RETURNTRANSFER => true )); $ret = json_decode(curl_exec($ch), true); curl_close($ch); if ($ret['responseStatus'] != '200') { throw Exception('Translation failed.'); } return $ret['responseData']['translatedText']; } echo translate('hola', 'es', 'en'); ?>
-
You are only displaying the form if $_POST['do'] is set in your script. You need to do "if $_POST['do'] is set then insert stuff, else display the form". You'll also want to escape the values from the user prior to using them in your query. In your case you should use the function called mysqli_real_escape_string.
-
You'll probably want to read some books about methodology and application design at some point. Learning the syntax is the simple part and can be done using the PHP manual alone.
-
Don't you mean $_SESSION['title'] = $_POST['title']; ? The other thing doesn't make sense...
-
It's because zero isn't greater than zero. You need to do "greater than or equals": if ($newusdbalance >= 0) { $balance = 'balanceplus'; } else { $balance = 'balanceneg'; }
-
That'll render the math LaTeX mod obsolete. I like that mod
-
Right, but you're still not in the same position as he is. You can appeal, he cannot. Therefore, he is more inclined to break the rules seeing as there isn't really another option. History has shown it lots of times - people doing stuff their masters/superiors/lords/whatever didn't want them to. The French Revolution, anti-government demonstrations in Burma in 2007 (which technically were illegal), American War of Independence ("American" dudes didn't do what British dudes wanted them to, they go to war and "American" dudes become American dudes because they won), and the list goes on...
-
That's easy to say living in a democracy...
-
I suppose you can tunnel through a computer outside of the firewall using SSH. I'm not suggestion that you should break the law in any way though.
-
And then they come crying to us again when they don't want people to find out that they received help so they want us to delete their topics.
-
Not just lack of posting, but also an overflow of non-OOP topics.
-
Google is and never will be a public service unless it's owned by a government. Just because a lot of people use it doesn't make it public service. They're not obliged to show anyone on their SERPs. Well, they must show the people who pay for positions, but those are unaffected by changes to their searching algorithm anyways.
-
TIME/DATE/DATETIME are formatted according to ISO 8601.
-
The cheapos aren't the good clients anyway. Getting someone to code a website is a premium service. Premium services cost money.
-
Any court would reject that lawsuit. Google can do whatever they want with their algorithm. It's not public service or whatever. You don't have the right to be displayed on Google.
-
For those wages you might as well just flip burgers at McD. You'd earn more money that way.
-
Well, it all comes down to this: How much is your time worth?
-
Need help with maths in a form, please help very important
Daniel0 replied to apg1985's topic in PHP Coding Help
Yes. -
Need help with maths in a form, please help very important
Daniel0 replied to apg1985's topic in PHP Coding Help
If they do not have any value then you aren't sending anything. It's just a matter of doing e.g. <option value="1000">$1000</option> essentially. $price was set to $_POST['select1'], i.e. the first select in your code. -
Then you can use this function to calculate your price: [tex]P(t) = t \cdot \lim_{x\to\infty} \left(\sqrt{\int (17x+48-5(3x))dx - 48x} \cdot \sum_{n = 0}^{t} n!\right)[/tex] P(t) is the price in USD and t is the time you expect to use measured in hours.
-
Need help with maths in a form, please help very important
Daniel0 replied to apg1985's topic in PHP Coding Help
Somehow I read it as "add 10%". Sorry about that. Same kind of logic though. -
Why can't you just print it and the reverse it manually? Do you have hundreds of slides or something?
-
Need help with maths in a form, please help very important
Daniel0 replied to apg1985's topic in PHP Coding Help
Uh... Isn't that basic arithmetic? $price = (float) $_POST['select1']; if ($_POST['select2'] == 'yes') { $price *= 1.1; } if ($_POST['select3'] == 'yes') { $price += 100; } You need to give your <option>s some values though... -
Make sure that $date is actually set. Try to echo it first to check.