/    Sign up×
Community /Pin to ProfileBookmark

opening a popup via a form in php

Hello everybody !!!
I’m not sure I’m porting in the right place, but, as part of it is javascript, I thought it would be OK here…
My problem :
I have a form, which posts informations using a php file. What I want is to have the page opened to a popup window…
Here is what I have so far :

<script language=”JavaScript” type=”text/javascript”>

function popupform(myform, windowname)
{
if (! window.focus)return true;
window.open(“messages.php”,”TAG”,”width=550,height=550,scrollbars=no”);
myform.target=windowname;
return true;
}
</script>

then, the form :
<form name=”form1″ method=”post” onSubmit=”popupform(this, ‘TAG’)”>

<p align=”center”>Veuillez choisir un pseudonyme :

<input type=”text” name=”name” maxlength=”30″ class=”pseudo” style=”BACKGROUND-COLOR:black;”>
<input name=”submit” type=”submit” class=”boutons” value=”Entrer dans le chat”>

</form>

what I get, when I post my things, is a stupid : “The requested method POST is not allowed for the URL /tag/chat/tag.htm “

I really don’t know what to do. I don’t understand why it won’t let me open a popup window…
Any solution would be really great !!!!!
Thanks a lot
Ness

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@JonaNov 21.2004 — [font=trebuchet ms]Try adding [/font][font=courier new]action="#"[/font][font=trebuchet ms] to your form tag.[/font]
Copy linkTweet thisAlerts:
@Ness_du_FratauthorNov 21.2004 — it still doesn't work... ? I get the same error message as before...
Copy linkTweet thisAlerts:
@JonaNov 21.2004 — [font=trebuchet ms]Try making it a "get" form instead of a "post" form. If that doesn't work, can you post a link to the page in question?[/font]
Copy linkTweet thisAlerts:
@Ness_du_FratauthorNov 21.2004 — now, it's giving me the same page as before. I mean, when I vlick on submit on my tag2.htm page, it opens a popup containing tag2.htm.. How strange...

Anyway, I found another solution for my design, but I would really want to know how I could make it work the way I wanted it to work from the beginning, so if you could help me, it would be great...

Here is the link, don't care about the design, I changed everything and didn't bother to change the things in the tag2.htm, as I'm not using this page anymore...

You just have to put something ( anything ) in the box and click submit...

[URL=http://lesangdesmiroirs.free.fr/tag/chat/tag2.htm]the page[/URL]

thanks a lot !!!
Copy linkTweet thisAlerts:
@JonaNov 21.2004 — [font=trebuchet ms]When you change the target of the form, it opens a new window with the "action" attribute's page. Because of this, there is no need to change the "action" of the form if you are using window.open.[/font]
Copy linkTweet thisAlerts:
@Ness_du_FratauthorNov 21.2004 — yeah, but still, even with action="#", it doesn't work...

I hate it when I don't understand... :mad: :p

Did it work for you ?
Copy linkTweet thisAlerts:
@JonaNov 21.2004 — [font=trebuchet ms]It did exactly as you said; it opened a new window with the same exact page in it.[/font]
Copy linkTweet thisAlerts:
@JonaNov 21.2004 — [font=trebuchet ms]Try:[/font]

<i>
</i>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="fr" dir="ltr"&gt;
&lt;head&gt;
&lt;title&gt;Document sans titre&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;link href="style.css" rel="stylesheet" type="text/css"&gt;
&lt;script type="text/javascript"&gt;
function popupform(myform, windowname)
{
window.open("messages.php",windowname,"width=550,height=550,scrollbars=no");
return false;
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body class="cadre"&gt;
&lt;div align="center"&gt;
&lt;p&gt;&lt;img src="../../Images/tag1.gif"&gt;
&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;form name="form1" method="get" action="" onSubmit="return popupform(this, 'TAG')"&gt;
&lt;table width="400" border="0" cellspacing="5" cellpadding="10"&gt;
&lt;tr&gt;
&lt;td colspan="2"&gt;&lt;p align="center"&gt;Veuillez choisir un pseudonyme : &lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;input type="text" name="name" maxlength="30" class="pseudo" style="BACKGROUND-COLOR:black;"&gt;&lt;/td&gt;

<i> </i>&lt;td&gt;
<i> </i>&lt;input name="submit" type="submit" class="boutons" value="Entrer dans le chat"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;/div&gt;&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@Ness_du_FratauthorNov 22.2004 — great !!! I just tested it, and it works !!!!!"Thanks thanks thanks !!!

but I wonder, then... Is it better to have the document loaded in the parent frame, or to open a popup ? The popup is big, so it shouldn't be a problem, but do you think all navigators will be able to open the popup ?

I have currently a huge problem with IE on Macintosh. It won't even open the first page. The source code is here, alright, but the page is not loading...

Do you have any idea why it's not working ?

Sorry to bother you again, you have already done much for me !!!

here is the web-site...

[URL=http://lesangdesmiroirs.free.fr]Le Sang des Miroirs[/URL]
Copy linkTweet thisAlerts:
@JonaNov 22.2004 — [font=trebuchet ms]Sorry, I have never owned a Mac, although I would like to and probably will soon. I'd love to help you more, but I can't do any testing on a Macintosh. Your best bet is to just change the "target" of the form and refrain from JavaScript use altogether. This way anyone without JavaScript can use the tagboard, and it is sure to work on any browser that understands HTML 4.01 - which should be all browsers by now.[/font]
×

Success!

Help @Ness_du_Frat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...