...

View Full Version : working in IE and not in firefox



NTGre
02-08-2006, 12:26 AM
i got a form to upload infos and pics in my database


HtmlT.php

include("config.inc.php");
include("funcionsT.inc.php");
.
.
.
<body>
<form enctype='multipart/form-data' action= '$action' method='post' name='upload_form'>
.
.
.
<input name="artist" type="text" size="34" value = $_POST[artist] >
.
<input name="song" type="text" size="34" value = $_POST[song] >
.
<input name="label" type="text" size="34" value =$_POST[label]>
.
<input name="serial" type="text" size="34" value =$_POST[serial]>
.
.
.
<input name="Submit" type="submit" class="style5" value="Submit your infos">

as you can see i m using
<form enctype='multipart/form-data' action= '$action' method='post' name='upload_form'>

this variable is defined by funcionsT.php
so if no errors to set action=uploadT.php
and if there are errors action=HtmlT.php so the user correct the input

funcionT.php


if(isset($Submit)){
$error_msg='';
if (trim($artist)=='' ) {
$error_msg.="<li>Please enter a <strong>Artist/Band Name </strong>max 30 max char long </li>";
}
if ( strlen(trim($artist)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $artist)) {
$error_msg.="<li> No special characters allowed in <strong>Artist/Band Name </strong></li>";
}
if (trim($song)=='' ) {
$error_msg.="<li>Please enter a <strong>Album/Song Title </strong>max 30 max char long </li>";
}
if(trim($song)=='' || strlen(trim($song)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $song)) {
$error_msg.="<li>No special characters allowed in <strong>Album/Song Title </strong></li>";
}
if(trim($label)=='' || strlen(trim($label)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $label)) {
$error_msg.="<li>Please enter a <strong>Label </strong>max 30 max char long No special characters</li>";
}
if(trim($serial)=='' || strlen(trim($serial)) > 30 || ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $serial)) {
$error_msg.="<li>Please enter a <strong>Serial No </strong>max 30 max char long No special characters</li>";
}


// display error message if any, if not, proceed to other processing
if($error_msg==''){
$action = 'uploadT.php';
} else {
$action = 'HtmlT.php';
$valid_error = "<ol><font color=red>$error_msg</font></ol>";
}
}


i dont know if this is the best way to do this but working fine in IE. :D

But in Firefox working only if i set the fields in order.
i mean that if i fill the field artist first and then the song etc.. the form working as expected.

if i set the 3 first fields and submit the form will display that the 4th field is empty.
next if i fill the 4th field(missing)and delete the first field the form ignore my deletion and continue to submit.

Any idead how to deal with this problem?? :confused:

degsy
02-08-2006, 03:56 PM
// display error message if any, if not, proceed to other processing
if($error_msg==''){
$action = 'uploadT.php';
} else {
$action = 'HtmlT.php';
$valid_error = "<ol><font color=red>$error_msg</font></ol>";
}

I'm not sure why you are changing the form action on error or success.

The usual way would be to output the error message to the page or a global error page

e.g.
if($err_msg != ""){
header("Location: error.php?msg=$err_msg");
}
else{
//ok
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum