Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7417359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:41:12+00:00 2026-05-29T07:41:12+00:00

I am creating a currency calculator using a Google API but don’t seem to

  • 0

I am creating a currency calculator using a Google API but don’t seem to be setting the variable selected from the drop-down box.

I create an array to hold 3 currencies:

<?php
$options = array(
    'usd' => 'USD',
    'eur' => 'EUR',
    'gbp' => 'GBP'
);
?>

The user selects one of the above values which are displayed in the form.

<form action="" method="post ">
    <p>
        Amount:<br />
        <input type="text" name="amount" />
    </p>
    <p>
        From:<br />
        <input type="text" name="from" />
    </p>
    <p>
        To:<br />
        <select name="position">      
            <?php foreach ($options as $value => $text): ?>                                     
                <option value="<?php echo $value ?>" 
                        <?php echo ($v['position'] == $value) ? 'selected="selected"' : '' ?> >
                            <?php echo $text ?>
                </option>
            <?php endforeach; ?>
        </select>
    </p>
    <p>
        <input type="submit" name="submit" />
    </p>
</form>

The following function is used to determine whether variables have been set and I echo out of results to ensure my findings.

if (isset($_POST['amount'], $_POST['from'], $_POST[$value])) {
    $amount = (int) $_POST['amount']; 
    $from = $_POST['from']; 
    $value = $_POST['value'];

    echo $amount;
    echo $from;
    echo $value; 
//    echo $text;
//    echo $selected; 
//    echo $options;  
//    echo $v; 
    exit();

I can successfully echo out the $amount and $from variables but don’t understand why I can get the $value variable from the drop-down box.

I’ve tried echoing out all the variables to no avail which makes me believe that the problem is with my coding in the form itself.

Any obvious issues spring to mind?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:41:14+00:00Added an answer on May 29, 2026 at 7:41 am

    Where is $v defined? Also, I don’t understand why you’re checking if $_POST[$value] exists then setting $value = $_POST['value']… and what is $value before it gets changed? What element has the name value? Shouldn’t you just be grabbing $_POST['position']?

    $_POST['position'] is the variable that will always contain which value of the select menu was selected, but I don’t see you actually using it anywhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a currency converter and using the Google Finance API to do so.
Creating a blog from scratch is a difficult process but I've been plodding along
I'm in the process of creating a small currency conversion script using the money.js
I'm making a mobile site using Dashcode to help me creating better UIs, but
Creating the closure is easy but using it is confusing for me. Here is
Creating a google map with store locations within 50 miles of user entered address.
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating extensions got much easier with Vs2010, but this seems not to be the
Creating a site in with FrogCMS and using alot of jquery to create an
Creating a calculator-like dialog, I noticed that quickly clicking on a button in IE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.