Jump to content

combining img and text validation


GD77

Recommended Posts

Hello:

 

I m trying to combine an image upload and text input and need them to be in separated forms because the second form element are driven from a database and need when the file is uploaded ( correctly ) it s path name or what ever will be inserted into the second form..

 

As soon as the first form is submitted what ever I ve in the second disappears, I am open to suggestions, thx.


print_r("<form name='FORM1' method='post' target='_self' type='multipart/form-data' class='....'>

<input type='file' name='img_Up'><button type='submit' name='btn_up' value='btn_up'>Upload IMG</button></form>");

print_r("<form  name='FORM2' method='post' target='_self' class='form_tbl_insert'><table class='tbl_insert'>");

while ($i < mysql_num_fields($qry_Fields)) {
$col = mysql_fetch_field($qry_Fields, $i);
        $value_Insert=$_POST[$col->name];

if(isset($value_Insert)) {$value_Insert1=strtolower(trim($value_Insert));}else{$value_Insert1="";}

  if (!$col) {print_r( "No information available<br />");exit;}
	//".$col->type." ".$col->max_length."
	if($col->name!=='id'){

	switch($col->name){
                    case 'br':$this->f_Len="Char: 3-11";$this->max_Len="11";$this->type='text';break;								
                    case 'mo':$this->f_Len="Char: 3-50";$this->max_Len="50";$this->type='text';break;
                    case 'sp':$this->f_Len="Char: 3-50";$this->max_Len="50";$this->type='text';break;
                    case "inadd":$this->f_Len="Char: 3-254";$this->max_Len="254";$this->type='text';break;
                    case "imgs":$this->f_Len="Char: 3-100";$this->max_Len="100";$this->type='text';break;
                    case "p_GA":$this->f_Len="Num: 3-7";$this->max_Len="7";$this->type='text';break;
                    case "p_GB":$this->f_Len="Num: 3-7";$this->max_Len="7";$this->type='text';break;
                    case "p_GC":$this->f_Len="Num: 3-7";$this->max_Len="7";$this->type='text';break;
                    case "active":$this->f_Len="Num: 0/1";$this->max_Len="1";$this->type='text';break;
                    default:$this->f_Len='';
                    }//END switch

print_r("<tr>
<td>".$i."</td>
<td>".$col->name."</td>

<td><input type='".$this->type."' name='".$col->name."' value='".$value_Insert1."' maxlength=".$this->max_Len.">
<div class='col_Len'>".$this->f_Len."</div></td></tr>");
}//END if not id
$i++;
}//END while
print_r("<tr><td> </td><td> </td><td><button type='submit' name='btn_sub' value='btn_sub'>Insert Data</button></td></tr></table></form>");	
mysql_free_result($qry_Fields);				

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.