The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
S-231: Adobe Form Designer and Form Client Vulnerabilities iBot Security Advisories (RSS) 0 03-27-2008 10:10 AM
cant submit anything congo Forum Support Area for Unregistered Users & Account Problems 1 10-21-2006 03:59 PM
Cannot submit a background job tansha Shell Programming and Scripting 2 06-20-2006 10:58 AM
How to submit cron jobs? siegfried Shell Programming and Scripting 4 04-21-2006 02:52 PM
Changing Unix form to Microsoft Word form to be able to email it to someone. Cheraunm UNIX for Advanced & Expert Users 8 05-24-2002 04:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-25-2009
nck nck is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 17
PHP Help with Form Submit

Hi,

I have a custom HTML form that has a couple radio buttons and a text field that requires a number.

I'm not a php programmer and could use some help with putting together php code to calculate a total based on the radio button selection and the text field number.

-------------------------------
Here is a snippet from the form:
<input value="$1.20 standard design" class="radio radio radio" id="$1.20 standard design" name="radio2" type="radio" />
<label for="$1.20/standard_design" class="radio_label">$1.20/standard_design</label>

<input value="$2.10 extended_design" class="radio radio radio" id="$1.20 standard design" name="radio2" type="radio" />
<label for="$2.10/extended_design" class="radio_label">$2.10/extended_design</label>

<div class="form_element cf_textbox">
<label class="cf_label">Quantity to order? *</label>
<input class="cf_inputbox required validate-number" maxlength="150" size="30" id="text_27" name="text_27" type="text" />
</div>
-------------------------------

I need PHP code to take one of the Radio button values and then multiply it by the Quantity, then from the the discount table apply the appropriate discount and save the total in a variable.

Quantity Discount table is:
50-99 10% Off 400-799 40% Off
100-199 20% Off 800-1999 50% Off
200-399 30% Off 2000-4999 60% Off

I appreciate any help with this.
Thanks
  #2 (permalink)  
Old 03-25-2009
ShawnMilo ShawnMilo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 252
I suggest you look up "PHP tutorial" on Google, find a simple example of reading values from the $_POST object, and write some code. It doesn't matter if you get it working perfectly; you can post what you have and ask for help then.

Without showing some effort, I doubt anyone will write the code for you.
  #3 (permalink)  
Old 03-26-2009
nck nck is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 17
I know, I am working on it and will post code for help if I can get it close.

I may need to hire someone to help out.
  #4 (permalink)  
Old 03-26-2009
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
This should get you started.


Code:
<?php

if ($_POST) {
        $total = $_POST['radio1'] * $_POST['text_27'];
        print "Total: $".$total."<br>";
        $qty = $_POST['text_27'];
        switch ($qty) {
        case ($qty > 50 && $qty < 100):
                $dis=10;
                break;
        case ($qty > 99 && $qty < 200):
                $dis=20;
                break;


        }
print "Qty:".$qty."<br>";
print "Discount:".$dis;

} else {
?>

<form method="post" action="<?php $_SERVER['PHP_SELF'];  ?>">
<input class="radio radio radio" id="$1.20 standard design" name="radio1" type="radio" value="1.20"/>
<label for="$1.20/standard_design" class="radio_label">$1.20/standard_design</label>
<br>
<input class="radio radio radio" id="$2.10 extended design" name="radio1" type="radio" value="2.10" />
<label for="$2.10/extended_design" class="radio_label">$2.10/extended_design</label>
<br>
<div class="form_element cf_textbox">
<label class="cf_label">Quantity to order? *</label>
<input class="cf_inputbox required validate-number" maxlength="150" size="30" id="text_27" name="text_27" type="text" />
<br>
<input type="submit">
</div>
</form>

<?php
}
?>


Last edited by Ikon; 03-26-2009 at 11:20 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0