GD77 Posted September 19, 2012 Share Posted September 19, 2012 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); Quote Link to comment https://forums.phpfreaks.com/topic/268560-combining-img-and-text-validation/ Share on other sites More sharing options...
Christian F. Posted September 19, 2012 Share Posted September 19, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/268560-combining-img-and-text-validation/#findComment-1379361 Share on other sites More sharing options...
Barand Posted September 19, 2012 Share Posted September 19, 2012 BTW why do you use a recursive print function (print_r() ) just to echo simple strings to the browser? Quote Link to comment https://forums.phpfreaks.com/topic/268560-combining-img-and-text-validation/#findComment-1379456 Share on other sites More sharing options...
GD77 Posted September 20, 2012 Author Share Posted September 20, 2012 Barand: just a habit.. ChristianF got a point their I ll try it thx. Quote Link to comment https://forums.phpfreaks.com/topic/268560-combining-img-and-text-validation/#findComment-1379518 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.