Jump to content

No-Refresh Help


Skittalz

Recommended Posts

I am creating a script that has the user input various values and then upon being submitted... The script does not refresh but displays the total. Can someone help me out? I've spent the last hour trying how to do it but I can't figure out what I'm doing wrong. Here's my code... Can someone help me out?

 

<?php 


include 'quote_functions.php';

if(isset($_POST['Calculate'])) {
  if(numeric($_POST['width'])) {
    $price = $_POST['width']*$_POST['height'];
    if($_POST['bannertype'] == '1') {
$price = $price * 3; }
    else if($_POST['bannertype'] == '2') {
$price = $price * 2.5;
    }
    $price = number_format($price,2);

  } else {
    
  }
  
}

?>

<html><head></head><body><div align='center'> 

<form method="post" action="204.php"> 
<table align='center' width='600' bordercolor='#000000' bordercolor='#222222' bordercolorlight='#102444' border=1>
  <tr>
    <td background='cellbg.jpg' align='center'><font color='#171F2D'><b>-=| Online Quotation |=-</b></font></td></tr>
  <tr>
    <td>
<table width=598 border=1>
  <tr>
    <td width=20%><div align='center'>Banner Type: <br>
	<select name="bannertype">
	  <option value="2">Simple Text Banner</option>
	  <option value="1">Full Color Banner</option>
	</select></div>
    </td>
    <td width=20%><div align='center'>Height: <br>
	<select name="height">
	  <option value="1">1</option>
	  <option value="2">2</option>
	  <option value="3">3</option>
	  <option value="4">4</option>
	  <option value="5">5</option>
	  <option value="6">6</option>
	  <option value="7">7</option>
	  <option value="8">8</option>
	</select> inch(es).</div>
    </td>
    <td width=20%><div align='center'>Width: <br>
	<input type="text" name="width" size="3" value="" /> inch(es).</div>
    </td>
  </tr>
  <tr>
    <td width=20%><div align='center'><b>Total</b>: $ <?php if(isset($price)) { echo $price; } else { echo "0.00"; }?>
	</div>
    </td>
    <td></td>

<td>
<input type="submit" name="Calculate" value="Calculate" />	<input type="submit" name="Order" value="Order" />
	</td></tr></table>
</table><br />

Link to comment
Share on other sites

this is what it does.

 

 

$val = "";

 

empty($val) would return true - so the statement is saying if its not empty.

 

then if i go if(isset($val)), it checks to see if there  is a variable called $val, therefore returning true.

 

basically its changing to testing if the variabel is set - to if it is empty

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.