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

  • Home
  • SEARCH
  • 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 64555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:48:29+00:00 2026-05-10T18:48:29+00:00

I have a form that is sending in sizes of things, and I need

  • 0

I have a form that is sending in sizes of things, and I need to see what the strings are equal to so that I can set the price accordingly. When i try to do this, it says that they are not equal, and i get no prices. This is the code i’m using:

if ($_POST['sizes'] == 'Small ($30)'){$total = '30';} if ($_POST['sizes'] == 'Medium ($40)'){$total = '40';} if ($_POST['sizes'] == 'Large ($50)'){$total = '50';} else {$total = $_POST['price'];} 

What am i doing wrong here? I can echo $_POST[‘sizes’] and it gives me exactly one of those things.

  • 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. 2026-05-10T18:48:30+00:00Added an answer on May 10, 2026 at 6:48 pm

    What Paul Dixon said is correct. Might I also recommend using a switch statement instead of that clunky chunk of if statements (which actually has a logic bug in it, I might add – $total will always equal $_POST['price'] when not 'Large ($50)')

    <?php  switch ( $_POST['sizes'] ) {     case 'Small ($30)' :         $total = 30;         break;     case 'Medium ($40)' :         $total = 40;         break;     case 'Large ($50)' :         $total = 50;         break;     default:         $total = $_POST['price'];         break; }  ?> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Because the productToEdit is a new product object populated from… May 11, 2026 at 11:27 am
  • added an answer Have a look at JNA. Here is the summary of… May 11, 2026 at 11:27 am
  • added an answer It's something the browsers do, as part of the process… May 11, 2026 at 11:27 am

Related Questions

I have a form that is sending in sizes of things, and I need
I have a form that is dynamically generated, and has dynamically generated id's (and
I have a child form that is throwing an ApplicationException in the Load event
I have a file upload form that is being posted back to a servlet
I have a form that contains a GridView control which is databound to an
I have a report that is used by a windows service and a form
I have a form that has multiple fields, and for testing purposes is there
I have a combobox on my form that is bound to a generic list
I have a JSP that is using Spring:form tags to bind controls to a
I have a usercontrol that is meant to take up the entire form. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.