illuz1on Posted May 29, 2007 Share Posted May 29, 2007 Hey The first block of code is my image preupload form, and it works 100% <?php include("config.inc.php"); // initialization $photo_upload_fields = ""; $counter = 1; // default number of fields $number_of_fields = 3; // If you want more fields, then the call to this page should be like, // preupload.php?number_of_fields=20 if( $_GET['number_of_fields'] ) $number_of_fields = (int)($_GET['number_of_fields']); // Firstly Lets build the Category List $result = mysql_query( "SELECT category_id,category_name FROM iwantto_guide" ); while( $row = mysql_fetch_array( $result ) ) { $iwantto_guide_list .=<<<__HTML_END <option value="$row[0]">$row[1]</option>\n __HTML_END; } mysql_free_result( $result ); // Lets build the Photo Uploading fields while( $counter <= $number_of_fields ) { $photo_upload_fields .=<<<__HTML_END <tr> <td> Photo {$counter}: <input name=' photo_filename[]' type='file' /> </td> </tr> <tr> <td> Caption: <textarea name='photo_caption[]' cols='30' rows='1'></textarea> </td> </tr> __HTML_END; $counter++; } // Final Output echo <<<__HTML_END <html> <head> <title>Lets Add A Guide</title> </head> <body> <form enctype='multipart/form-data' action='upload.php' method='post' name='upload_form'> <table width='90%' border='0' align='center' style='width: 90%;'> <tr> <td> Select Category <select name='category'> $iwantto_guide_list </select> </td> </tr> <tr> <td> <p> </p> </td> </tr> <!-Insert the photo fields here --> $photo_upload_fields <tr> <td> <input type='submit' name='submit' value='Add Guide' /> </td> </tr> </table> </form> </body> </html> __HTML_END; ?> I then tried to add it into a action like this below, and it just shows up a blank screen when I call the action... ////////////////////////////////////////////////////////////////////////////////////////////////// } elseif( $_GET["action"] == "add4" ){ // Add Info PRE ACTION //////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////// THIS IS WHERE I PUT THE CODE //////////////////////////////////////////////////////////////////////////////////////////////////// Anyone please give a piece of advice on how to fix this, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/53467-adding-a-form-into-an-action/ Share on other sites More sharing options...
MadTechie Posted May 29, 2007 Share Posted May 29, 2007 you added that.. where! Quote Link to comment https://forums.phpfreaks.com/topic/53467-adding-a-form-into-an-action/#findComment-264296 Share on other sites More sharing options...
illuz1on Posted May 29, 2007 Author Share Posted May 29, 2007 Thanks for the reply!! I merged the two like this: <?php ////////////////////////////////////////////////////////////////////////////////////////////////// if( $_GET["action"] == "add3" ){ // Add Info ACTION /////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////// include("config.inc.php"); // initialization $photo_upload_fields = ""; $counter = 1; // default number of fields $number_of_fields = 5; // If you want more fields, then the call to this page should be like, // preupload.php?number_of_fields=20 if( $_GET['number_of_fields'] ) $number_of_fields = (int)($_GET['number_of_fields']); // Firstly Lets build the Category List $result = mysql_query( "SELECT category_id,category_name FROM gallery_category" ); while( $row = mysql_fetch_array( $result ) ) { $photo_category_list .=<<<__HTML_END <option value="$row[0]">$row[1]</option>\n __HTML_END; } mysql_free_result( $result ); // Lets build the Photo Uploading fields while( $counter <= $number_of_fields ) { $photo_upload_fields .=<<<__HTML_END <tr> <td> Photo {$counter}: <input name=' photo_filename[]' type='file' /> </td> </tr> <tr> <td> Caption: <textarea name='photo_caption[]' cols='30' rows='1'></textarea> </td> </tr> __HTML_END; $counter++; } // Final Output echo <<<__HTML_END <html> <head> <title>Lets upload Photos</title> </head> <body> <form enctype='multipart/form-data' action='upload.php' method='post' name='upload_form'> <table width='90%' border='0' align='center' style='width: 90%;'> <tr> <td> Select Category <select name='category'> $photo_category_list </select> </td> </tr> <tr> <td> <p> </p> </td> </tr> <!-Insert the photo fields here --> $photo_upload_fields <tr> <td> <input type='submit' name='submit' value='Add Photos' /> </td> </tr> </table> </form> </body> </html> __HTML_END; ////////////////////////////////////////////////////////////////////////////////////////////////// } elseif( $_GET["action"] == "add4" ){ // Add Info PRO ACTION /////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////// ?> Quote Link to comment https://forums.phpfreaks.com/topic/53467-adding-a-form-into-an-action/#findComment-264302 Share on other sites More sharing options...
MadTechie Posted May 29, 2007 Share Posted May 29, 2007 OK first you need to close that if statement.. second.. what was you expecting to appear? because that logic says if add3 then show this if add4 show nothing! Quote Link to comment https://forums.phpfreaks.com/topic/53467-adding-a-form-into-an-action/#findComment-264310 Share on other sites More sharing options...
illuz1on Posted May 29, 2007 Author Share Posted May 29, 2007 well add4 is there, just didnt include the code for it ... too much.. Add 3 is supposed to just show the FORM for add4 to process.... but it shows blank not the form Quote Link to comment https://forums.phpfreaks.com/topic/53467-adding-a-form-into-an-action/#findComment-264320 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.