zhahaman2001 Posted March 21, 2007 Share Posted March 21, 2007 ok I have a page that has like 50 inputs... (to create an image) so many that I want a preview button and a submit button the submit will add the info to the database like it should but the preview button will make a pop up with a new page my problem is that i need all the info sent to both pages....if they click preview i need all the inputs send to preview.php and if the user clicks submit i need all the inputs to go to generate.php how do i do this? Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/ Share on other sites More sharing options...
kenrbnsn Posted March 21, 2007 Share Posted March 21, 2007 Don't have two scripts. Handle everything with one processing script. Decide which code to use by checking the value of the submit button variable. Ken Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-211790 Share on other sites More sharing options...
jitesh Posted March 21, 2007 Share Posted March 21, 2007 You Preview page is popup. right ? I think you can access all your inputs of parent page from javascrips like this. window.opener.document.formname.inpuname.value But if you want to access all in PHP scrips then you need to send all data in query string <input type="button" name="preview" onclick="javascript:popup()"> <script language="javascript"> function popup(){ var query_str = ""; for(i=0;i<document.formname.elements.length;i++){ query_str += document.weburl.elements(i) .name+"="+document.weburl.elements(i).value query_str += "&"; } window.open("prevew.php?"+query_str,,'width=100;height=100'); } </script> Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-211793 Share on other sites More sharing options...
zhahaman2001 Posted March 21, 2007 Author Share Posted March 21, 2007 ill give it a shot thanks Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-211800 Share on other sites More sharing options...
zhahaman2001 Posted March 21, 2007 Author Share Posted March 21, 2007 i seem to keep haveing that javascript error icon in the bottom of my browser what am i doing wrong? i am puting <script language="javascript"> function popup(){ var query_str = ""; for(i=0;i<document.formname.elements.length;i++){ query_str += document.weburl.elements(i) .name+"="+document.weburl.elements(i).value query_str += "&"; } window.open("prevew.php?"+query_str,,'width=100;height=100'); } </script> in the head right? Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-211802 Share on other sites More sharing options...
jitesh Posted March 21, 2007 Share Posted March 21, 2007 There is a prb with this site that it do not show Big parentheses So I have mention by elements(i) instead of ( keep Big parenthesis ------------------------------------------ <script language="javascript"> function popup(){ var query_str = ""; for(i=0;i<document.formname.elements.length;i++){ query_str += document.weburl.elements(i) .name+"="+document.weburl.elements(i).value query_str += "&"; } window.open("prevew.php?"+query_str,,'width=100;height=100'); } </script> Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-211819 Share on other sites More sharing options...
zhahaman2001 Posted March 22, 2007 Author Share Posted March 22, 2007 i do not understand what you are trying to say.... Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-212491 Share on other sites More sharing options...
jitesh Posted March 22, 2007 Share Posted March 22, 2007 Check below Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-212558 Share on other sites More sharing options...
jitesh Posted March 22, 2007 Share Posted March 22, 2007 There is a prb with this site that it do not show Big parentheses So I have mention by elements(i) instead of ( keep Big parenthesis ------------------------------------------ <script language="javascript"> function popup(){ var query_str = ""; for(i=0;i<document.formname.elements.length;i++){ query_str += document.weburl.elements [ i ] .name+"="+document.weburl.elements[ i].value query_str += "&"; } window.open("prevew.php?"+query_str,,'width=100;height=100'); } </script> Link to comment https://forums.phpfreaks.com/topic/43615-2-submits-useing-the-same-inputs/#findComment-212559 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.