all HTML

Accèdez à votre compte : 

Créer un compte …

Perte de mot de passe …

  • Accueil
  • Forum de discussions
  • Publications
  • Communauté

Poser une question

Sélection des sujets

  • Toutes les discussions
  • Questions sans réponse
  • par langage de programmation :
    html css javascript php sql asp xml java C# action script
  • par thématique :
    animation - motion design graphisme - webdesign audio - vidéo accessibilité droit - législation web apps - logiciels référencement - seo hébergement administration serveur site web e-commerce

validation formulaire

Sujet publié le 06/08/2009 par philou83 et classé dans php sql

Bonjour,

J'ai un problème sur un formulaire mais qui n'apparait que sur certains postes de travail.
Le formulaire en question se présente sous la forme d'une liste de commandes à compléter et valider.Chaque ligne se comporte comme un formulaire, après avoir complété une ligne l'utilisateur valide, le traitement s'effectue (mise en base de donnée) puis rend la main, l'utilisateur peut retourner sur la page des commandes à valider ou faire autre chose.
Sur la plupart des poste de travail pas de problème. mais sur un poste, et peut-être d'autres, dans l'entreprise, la première validation de commande s'exécute bien mais dès la 2ème la validation ne s'exécute pas. Le problème vient peut-être du navigateur.
Quelqu'un a-t-il déja rencontré ce genre de problème ?
Je me doute bien que l'on va me demandre des éclaircissements pour mieux cerner mon problème. Autre obstacle il s'agit d'un extranet donc non accessible et il faudra se contenter de mes explications plus ou moins obscures ou du code).

Merci

par philou83, 06/08/2009 à 11h54

répondre

Bha le code alors stp... :)

Adrien

par AdrienVH, 06/08/2009 à 12h35
http://www.adrienvanhamme.fr/

formulaire :
----------------------------------------------
<html>
<head>
<title>Besoin client/commandes à valider</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
<script src="includes/scripts/calendar.js"></script>
<script src="includes/scripts/popup.js"></script>
<script language="JavaScript" type="text/javascript">

function is_int(Num){
return !(Num-parseInt(Num)>0)}

function Verif_order_demand(ID){
var check_numAT=document.getElementById("numAT"+ID).value;
var check_date=document.getElementById("date"+ID).value;
var check_shipping=document.getElementById("shipping"+ID).value;
var check_garoprice=document.getElementById("garoprice"+ID).value;
var check_fobprice=document.getElementById("fobprice"+ID).value;

if (check_numAT==""){
alert ("Indiquez un N° de commande");
return false;
}
if (check_date==""){
alert ("Indiquez une date de livraison");
return false;
}
if (check_shipping==""){
alert ("Indiquez un shipping");
return false;
}
else {
if (check_shipping=="France"){
if(check_garoprice=="" || check_garoprice=="0.00" || isNaN(check_garoprice)){
alert ("indiquez un prix en €");
return false;
}
}
else {
if(check_fobprice=="" || check_fobprice=="0.00" || isNaN(check_fobprice)){
alert ("indiquez un prix en $");
return false;
}
}
}
}
</script>
</head>
<body>
<div style="text-align: center;">
<?php
session_start(); //demarrage de la session
if(!empty($_SESSION['lastname'])){
include('includes/header.php');
require('includes/config.php');// connexion à la base
$db = mysql_connect($server,$login,$pass);
mysql_select_db($db_name,$db);
// protection session manager -1/2 start -
$sqlc="select group_id from customers where lastname like '".$_SESSION['lastname']."'";
$reqc=mysql_query($sqlc)or exit ('Erreur SQL !'.$sqlc.'<br>'.mysql_error());
$datac=mysql_fetch_array($reqc);
$group_id=$datac['group_id'];
if ($group_id==2){

// protection session manager -1/2 end -
$sql="select o.order_id,o.order_web_number,o.order_date_demand,o.order_supplier, o.order_comment,o.order_shipping,o.product_ref,o.order_product_quantity,o.order_garo_price,o.order_fob_price,o.order_subsidiary_date,o.order_FOB_date, p.product_designation from orders o, products p
where o.order_status = 4 and o.product_ref=p.product_ref order by o.order_supplier,o.order_web_number,o.order_date_demand";
$req=mysql_query($sql)or exit ('Erreur SQL !'.$sql.'<br>'.mysql_error());
?>
<br>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="page_title">Besoin client/commandes à valider</td>
</tr>
</table>
<br>
<table border="1" width="100%" bgcolor="cccccc" cellpadding="0" cellspacing="0" style="background-color: #f2f5fa;">
<tr class="table_subtitle2">
<td width="40">Date demande</td>
<td width="40">Client</td>
<td width="60">N° commande client</td>
<td width="60">AT reference Designation</td>
<td width="40">Shipping</td>
<td width="50">€ Price exwork Paris excluding VAT</td>
<td width="50">FOB Asia price USD</td>
<td width="30">Qty</td>
<td width="35">Estimated delivery date in subsidiary</td>
<td width="35">Delivery FOB Asia date</td>
<td width="60">Comments</td>
<td width="40">N° de commande AT</td>
<td width="40">Valider</td>
</tr>
<?php
$ligne=0;
while( $data=mysql_fetch_array($req) ){
$ligne++;
$subsidiary = supplier_country($data['order_supplier']);
echo '<form method="POST" action="traitement_valide_order.php" ID="'.$ligne.'" onSubmit="return Verif_order_demand('.$ligne.')">
<tr class="order_complet">
<td width="40">' . $data['order_date_demand']. '</td>
<td width="40">' . $subsidiary. '</td>
<td width="60">' . $data['order_web_number']. '</td>
<td width="60"><a onMouseOver="Ouvrir(window.open(\'designation.php?designation=' . $data['product_designation']. '\',\'p\',\'width=400,height=20,menubar=no\'))" onMouseOut="Fermer()">' . $data['product_ref']. '</a></td>
<td width="40">
<select ID="shipping'.$ligne.'" name="shipping['.$data['order_id'].']" size="1">
<option selected value="' . $data['order_shipping']. '">' . $data['order_shipping']. '</option>
<option value="France">France</option>
<option value="Asia 100% boat">Asia 100% boat</option>
<option value="Asia 100% air">Asia 100% air</option>
<option value="Asia 50% air 50% boat">50% air 50% boat</option>
</select>
</td>
<td width="50"><input type="text" ID="garoprice'.$ligne.'" name="garo_price['.$data['order_id'].']" size="7" value="' . $data['order_garo_price']. '"></td>
<td width="50"><input type="text" ID="fobprice'.$ligne.'" name="fob_price['.$data['order_id'].']" size="7" value="' . $data['order_fob_price']. '"></td>
<td width="30"><input type="text" name="update_qty['.$data['order_id'].']" size="5" value="' . $data['order_product_quantity']. '"></td>
<td width="35"><table cellspacing="1" cellpadding=1" border="0" width="100%">
<tr>
<td align="right" width="50%"><input type="text" maxLength="10" name="subsidiary_date['.$data['order_id'].']" size="10" ID="date'.$ligne.'" value="' . $data['order_subsidiary_date']. '" onblur="Verif_order_demand($ligne)"></td>
<td align="left" width="50%"><a href="#calendar"><img src="includes/graphics/calendar.jpg" border="0" onclick="javascript:displayCalendar(\'date'.$ligne.'\', event);" id="calendarImg" alt="Choose the date" title="Choose the date"/></a></td>
</tr>
</table>
<div id="calendar"></div></td>
<td width="35">'.$data['order_FOB_date'].'</td>';
if (!empty($data['order_comment']))
{echo '<td width="60"><a onMouseOver="Ouvrir(window.open(\'comments.php?comments=' . $data['order_comment']. '\',\'p\',\'width=400,height=20,menubar=no\'))" onMouseOut="Fermer()">Comments</a></td>';}
else {echo '<td width="60"><img src="images/pixel_trans.gif" width="1" height="1"></td>' ;}
echo '<td width="40"><input type="text" ID="numAT'.$ligne.'" name="valid_order['.$data['order_id'].']" size="10"></td>
<td width="40">
<input type="submit" name="action" value="valider"></td>
<input type="hidden" name="order_web_number" value="' . $data['order_web_number'] . '">
<input type="hidden" name="order_supplier" value="' . $data['order_supplier'] . '">
</tr></form>';
}

?>
</table>
<?php

// protection session manager -2/2 start -
}
else return_login();
// protection session manager -2/2 start -
}
else return_login();
?>

</body>
</html>
-----------------------------------------------------------------------------
Traitement :

-------------------------------------------
<html>
<head>
<title>orders treatment</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<?php
session_start(); //demarrage de la session
if(!empty($_SESSION['lastname'])){
include('includes/header.php');
require_once('includes/config.php');// connexion à la base
$db = mysql_connect($server,$login,$pass);
mysql_select_db($db_name,$db);
$supplier = $order_supplier;
$date = date("YmdHis");
$jour = date("Ymd");
$alert=0;

// ### validation des commandes par le siège et retour vers le demandeur status = 4 - debut
if(isset($_POST['action']) and $_POST['action']=="Valider"){
foreach ($valid_order as $id=>$date){
if (!empty($valid_order[$id])){
mysql_query("UPDATE orders SET order_product_quantity = '".$update_qty[$id]."', order_subsidiary_date = '".$subsidiary_date[$id]."', order_garo_price = '".$garo_price[$id]."', order_fob_price = '".$fob_price[$id]."',order_shipping = '".$shipping[$id]."',order_at_number = '".$valid_order[$id]."', order_status = 6 , order_date_validate = '".$jour."' WHERE order_id ='".$id."'");
$alert=1;
}
}
if ($alert==0){echo '<table border="0" align="center" cellpadding="0" cellspacing="0" width="795"><tr><td align="center" class="page_title">Indiquez un N° de commande<br><a href="order_valide.php"><font color="FFFFFF">Retour commandes à valider</font></a></td></tr></table>';}
else{
echo '<table border="0" align="center" cellpadding="0" cellspacing="0" width="795"><tr><td align="center" class="page_title">Commandes validées</td></tr></table>';
}

//echo '<table border="0" align="center" cellpadding="0" cellspacing="0" width="795"><tr><td align="center" class="page_title">Indiquez un N° de commande<br><a href="order_valide.php">Retour</a></td></tr></table>';

// envoie mail commande validée siège et clients
// regoupé dans un mail journalier : TraitCro_oxo//QUALIF/traitements/mail_valide_order.php - batch à 20h30

}
// ### validation des commandes par le siège et retour vers le demandeur status = 4 - fin

// protection session manager -2/2 start -
}
else return_login();
?>
<body>
</body>
</html>

----------------------------------------------------------------------------

Merci

par philou83, 06/08/2009 à 14h08

répondre

  • nous contacter
  • mentions légales