Jump to content

2 submits useing the same inputs....?


zhahaman2001

Recommended Posts

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

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>

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?

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>

 

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>

 

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.