Creating a Currency Converter in PHP – Video Tutorials

By | April 29, 2013
currency converter in PHPMy last tutorial on this blog was on creating a simple calculator in PHP, and already I’ve shared a complete series of video tutorials about PHP, however, you may have come across different websites on the internet where you see online currency converters. These kind of currency converters may easily be created with PHP, and I’ve video tutorials for you today to create a simple currency converter in PHP. I’ll also be giving you the source code which I used during these video tutorials. As this will be a simple converter in design, however, you may design it using CSS and HTML. But the main aim is to create such application and enhance your development skills. Now let’s start creating it without delay.

How to Create A currency converter in PHP?

This question is unnecessary now, because we’ve already discussed it (((:))). And we are now going to create the converter in PHP, and you might know PHP gives you much power to create complex applications, more than a Facebook application. We’ll create this application simply by using IF Statements in PHP and we don’t need to use MySQL etc, because we’re not gonna sending any data to the server.
For creating a converter in PHP you’ll need to create a page called “converter.php” in which you’ll first create a simple converter using HTML form tag and some input tags, and after creating that you’ll need to write a PHP script for that converter. You can learn this all from below tutorials.
First watch below video tutorials to understand creating currency converter, and below the tutorials, you can find the source code which was used in these video tutorials:
Hey, Having watched video tutorials, I’m hopefully saying you’ve understood what I wanted to teach. Now let’s have a look at the source code of this application, this is the HTML part of the converter:

<title> PHP currecny Convertor</title>
<form align=’center’ action=’convertor.php’ method=’post’>
Enter Amount:<input type=’text’ name=’amount’>
From:<select name=’cur1′>
To:<select name=’cur2′>
<input type=’submit’ name=’submit’ value=’Convert Now’>

Now when you created a form with HTML, then you need to create a PHP script for making this converter to work properly, here is the PHP script for this:

$amount = $_POST[‘amount’];
$cur1 = $_POST[‘cur1’];
$cur2 = $_POST[‘cur2’];

if($cur1==”Dollar” AND $cur2==”PKR”){
echo “<center><b>Your Converted Amount is:</b><br></center>”;
echo “<center>” . $amount*97.5 . “</center>”;

if($cur1==”Dollar” AND $cur2==”Indian”){
echo “<center><b>Your Converted Amount is:</b><br></center>”;
echo “<center>” . $amount*48 . “</center>”;

if($cur1==”Dollar” AND $cur2==”Afghani”){
echo “<center><b>Your Converted Amount is:</b><br></center>”;
echo “<center>” . $amount*54 . “</center>”;

if($cur1==”Pound” AND $cur2==”PKR”){
echo “<center><b>Your Converted Amount is:</b><br></center>”;
echo “<center>” . $amount*160 . “</center>”;

if($cur1==”Pound” AND $cur2==”Indian”){
echo “<center><b>Your Converted Amount is:</b><br></center>”;
echo “<center>” . $amount*120 . “</center>”;

if($cur1==”Pound” AND $cur2==”Afghani”){
echo “<center><b>Your Converted Amount is:</b><br></center>”;
echo “<center>” . $amount*100 . “</center>”;
} }

I’ve used few currencies in this application, however, you may use as many as you want, jut increase the options in select box and increase the variables in PHP.

So how was this tutorial? did you learn something in PHP? and do love programming in PHP? and will I be a perfect web developer in the future or not? Your opinion is warmly welcomed! Take Care!

Category: PHP Video Tutorials Web Development

About Haiinteractive

Haiinteractive , for the past five years we have been in the IT industry with passion for web designing. We are passionate about bringing together our product engineering and management skills to create innovative solutions. Currently we are doing template selling, domain name selling. Our main focus is on providing high value services ranging from web designing, developing & maintaining, Web/Mobile Applications Development, Internet Marketing/SEO services and also other web-based industry specific products for businesses.Follow Us: Twitter : Facebook

11 thoughts on “Creating a Currency Converter in PHP – Video Tutorials

  1. Hafeez Khan

    Thanks Wali Bhai great tutorials about php develop currency calculator.
    very helpful tutorial for php beginner. Keep it up bro.

    i have off topic question bro. please dont mind.

    Wali bhai i have received 350+ unique visitors. So thinks its not a perfect time to apply for adsense. so i was thinking to apply for chitika.

    So whats your openion. Is there will be any issue on my blog with chitika. any effectness by blog rank, SEO. and many mores.

    Please guide me. what should i do. rank is improving day by day.

    now its under 1 lakh. So what should i do chitika will best for me or any others you personally like thats.

    Also mention me used banner ads. or links ads.

    thanks and hope for earlier reply. Coming back bro.

    1. Wali Khan

      You are welcome to ask questions related to the topic, but as you said you want to use PPC ads on your site, then my suggestion is Infolinks Chitika because they are better than others. However, as per Adsense I can’t say anything, because it’s all their decision, however, your blog looks good for Adsense, but keep in mind if you receive 50% of your total traffic from search engines then apply for Adsense, because Adsense is based totally on targeted search traffic.

  2. Adil Muhammad Yousuf

    Wali bhai, which website is better to earn money or i am little confuse to select
    one i found out that which one is better but still not get proper response.

  3. Hafeez Khan

    Wali bro please tell me what is the basic eligibility criteria for premium adsense account.

    I mean that i we have a adsense account then how can we get premium adsense publisher. what is the criteria for thats. and How can we get thats.

    Also tell me have you got premium accounts on mentions reply must.

    1. Wali Khan

      I’ve not yet become Adsense premium publisher? who told you this?

      However, as per premium account’s criteria you can better ask Muhammad Mustafa of MBT who recently became Adsense premium publisher, but as far as I know the information can’t be shared with anyone when someone becomes premiums publishers, you didn’t read these posts:

    1. Wali Khan

      Thanks for stepping by and I hope I’ll serve you more in the future with useful tutorials.


Speak Your Mind