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
https://forums.phpfreaks.com/topic/268560-combining-img-and-text-validation/
Share on other sites

You need to store the results from the first form in some temporary location, and send some sort of value identifying its location to the second form. Then, after the second form has been validated, retrieve the first set of details and add them all to the permanent storage.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.