Page 1 of 1

URL problem

Posted: Tue Oct 21, 2008 10:03 am
by flaming
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.


Hi i'm new to the php world

i'd like to know is it possible to submit data from a html form to a url then open it in a new window

here is an example of the code i've got so far but it keeps opening in the same window

Code: Select all

<form method="PUT" target="_blank">
<input name="postcode" type="text" onclick="clickclear(this, 'Post Code')" onblur="clickrecall(this,'Post Code')" value="Post Code" size="10" maxlength="10" />
<input type="hidden" name="comppost" value="B66QE" />
<input name="submit" type="submit" onclick='window.location = "http://maps.google.co.uk/maps?saddr=" + postcode.value + "&daddr=" + comppost.value + ""; return(false);' value="Get Directions" />
</form>
any ideas??

any suggestions welcome

Thanks
James


~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: Posting Code in the Forums to learn how to do it too.

Re: URL problem

Posted: Tue Oct 21, 2008 10:10 am
by pickle
Yes it is possible, but it has nothing to do with PHP (which only runs on the server).

If you put a "target" attribute in your <form> tag and give it a value of "_blank" or "_new", it should open in a new window. I'm not sure how compliant that is to XHTML standards though.

Re: URL problem

Posted: Tue Oct 21, 2008 10:13 am
by flaming
thank you

i've got _blank and just tried _new but neither work unfortunately

could you suggest somewhere for me to look for an answer??

Much appreciated

Re: URL problem

Posted: Tue Oct 21, 2008 10:22 am
by pickle
Google

Re: URL problem

Posted: Tue Oct 21, 2008 12:44 pm
by papa
I've never used target in a form element and I'm not so sure it works.

You could do a php execution after the form is submitted instead, using php and javascript.