Current location: Hot Scripts Forums » Programming Languages » PHP » form submit button doesn't work kindly help?


form submit button doesn't work kindly help?

Reply
  #1 (permalink)  
Old 12-30-11, 05:57 AM
samad samad is offline
New Member
 
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Post form submit button doesn't work kindly help?

hi friends
i have a form with 3 fields .all data are fetching from data base now i have 1 problem that when i click on submit the page show warning error of undifined index.
i paste my code here kindly help me i m in a gr8 trouble..i also attach these 2 files if any 1 having problm to understand..guys plz help me out.
thanks.

--------------------------------code----------------------------
This is one file name : bkpint_tariff.php


<?php
require ('sql_connect.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>International Tariff</title>
</head>

<script type="text/javascript" src="jquery-1.2.3.min.js"></script>
<script>
function show_weights(){
var shipment_id;
shipment_id = jQuery('#shipment_id').val();
jQuery('#shipment_id').attr('disabled', 'disabled');
$.ajax({
type: "POST",
url: "ajax_show_weights.php",
data: "find=weight&shipment_id="+shipment_id,
success: function(html){
$("#weight").append(html);
}
});
}

</script>
<br></br>

<div style="float:right; width:250px; padding-right: 50px;">
<a href="#"><img src="http://ocs.com.pk/newweb/wp-content/themes/ocs/images/logo.png">
</a></div>
<center><h1>International Tariff</h1></center>


<table width="385" height="200" style=" border:2px solid silver" cellpadding="6px" cellspacing="0px" align="center" border="0">

<form method="POST" action="bkpint_tariff.php">

<tr>
<td colspan="3" style="background:#0066FF; color:#FFFFFF; fontsize:50px">International Tariff</td></tr>

<tr>
<td>Selection Of countries :</td>
<td>
<select name="country_id">
<option value="">--SELECT--</option>


<?php
$q= "select * from country";
$r=my_query ($q);
while ($row = mysql_fetch_array($r)){
?>

<option value ="<?php echo $row['id'];?>"> <?php echo $row['countries_name']; ?>
</option>
<?php
}
?>
</select>
</td>
</tr>


<tr>
<td>Selection of Shipments</td>
<td>
<select name="shipment_id" id="shipment_id" onChange="show_weights();">
<option value="">--SELECT--</option>

<?php
$q = "Select * from shipment order by id desc";
$res = my_query($q);
$cnt = mysql_num_rows($res);
while($row = mysql_fetch_assoc($res)){
?>
<option value="<?php echo $row['id'];?>"><?php echo $row['shipment_name'];?></option>
<?php
}
?>
</select>
</td>
</tr>

<tr>
<td> Selection of Weight </td>
<td id="show_weights"> </td>
</tr>


<div class="form-items" id="country">
</div>

<div class="form-items" id="shipment">
</div>

<div class="form-items" id="weight">
</div>

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

</form>

<table width="385" style=" border:2px solid silver" cellpadding="6px" cellspacing="0px" align="center" border="0">
<tr>
<td>
<?php
if(isset($_POST['submit']))
{
$country_id = $_POST['country_id'];
}

?>

<?php

//This is PHP validation
if(empty($weight) || empty($country_id) || empty($shipment_id)){
?><center><?php echo "Please filled all the fields first.";?></center>
<?php
}
else{
$s = "select r.*
from rates r, zones_countries_mapping zcm
where
r.shipment_id=$shipment_id
AND
r.weight_id = $weight_id
AND
zcm.zone_name = r.zone_name
AND
zcm.country_id = $country_id";

$result = mysql_query($s);
$row = mysql_fetch_assoc($result);

//print_r($row);
?>
</td>
</tr>
<tr style="background:#00CFFF; color:black;">
<td><center><strong><font size="3"> Rate : </font></strong>


<?php

$val = (float) $row['value'] * 89 * 1.16 * 1.10;
echo "<strong>"."Rs"."."."&nbsp;".$val;
?>

</center>
</td>
</tr>

<?php
}
?>
</table>
</table>



--------------------------------code 2nd file---------------------------------------------------------------------
This file name is "ajax_show_weight.php"


<?php require('sql_connect.php'); ?>

<?php
$shipment_id = $_POST['shipment_id'];

if(isset($_POST['shipment_id'])){$shipment_id = $_POST['shipment_id'];} else{$shipment_id = NULL;}

if (isset($_POST['find'])) { $find = $_POST['find'];} else{$find = NULL;}

if($find == 'weight'){
?>
<select class="select" name="weight_id" id="weight_id">
<option value="">--SELECT--</option>

<?php
$q = "Select * from weights wgt where wgt.shipment_id = $shipment_id order by wgt.id";
$res = my_query($q);

while($row = mysql_fetch_assoc($res)){
?>
<option value="<?php echo $row['id'];?>"><?php echo $row['value'];?></option>
<?php
}
?>
</select>
<?php
}
?>
Attached Files
File Type: doc These 2 script are here kindly check it.doc (31.0 KB, 0 views)
Reply With Quote
  #2 (permalink)  
Old 01-03-12, 08:07 AM
alxkls alxkls is offline
Newbie Coder
 
Join Date: Nov 2011
Posts: 98
Thanks: 0
Thanked 9 Times in 9 Posts
the undefined index is usually shows up because of the apache cnfiguration and is not actually an error. its usually a warning. try addin
Code:
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
at the top
Reply With Quote
Reply

Bookmarks

Tags
c++, html, jquery, perl, php


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT! Mail form Flash 8/MX PHP doesn't work anymore Dougielove Script Requests 4 03-15-09 08:50 AM
The Art Nexus seeking PHP programmers TheArtNexus Job Offers & Assistance 5 02-26-08 03:08 AM
submit from form 1 to form 3 bypassing form 2 buzzby PHP 1 06-01-05 02:06 PM
submit button?? tcooper PHP 3 07-15-04 04:46 AM
submit form? tcooper PHP 5 12-12-03 03:30 PM


All times are GMT -5. The time now is 08:59 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.