By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,409 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,409 IT Pros & Developers. It's quick & easy.

form action to same file opens new window

P: n/a
Two questions late at night and going stir crazy. Anybody who takes pity on
me will have my undying gratitude and a virtual bottle of beer.
I've tried to look them both up on the php.net, and elsewhere, but without
success.

1. Am writing a php program which checks entries in a form on a previous
page. It then asks for any empty fields to be filled, and submits the
resulting form back to itself to check it again.

In other words the file "checkblank.php" includes this line within the php:

echo "<form target=\"checkblank.php\" method=\"post\">";

When the form is submitted it opens in a new window (in FireFox). In Firefox
it is not a disaster as the variables and arrays are not lost, and the
program works, but popups are not something I like. In IE the whole thing
collapses in a heap as the variables appear not to be passed to the new
window. Needless to say, the vast majority of users will have IE. Is there a
reason I'm unaware of, and can it be stopped easily?

2. Can anybody suggest a quick and easy way to strip arrays? stip_tags is
fine with variables, but converts arrays to variables. I'd like to use it
for the sake of security though. I don't particularly want to translate the
array into a whole lot of variables, as it's a big array.

Thanks
JB

Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
In article <6Y*****************@read1.cgocable.net>, Jo*@Blow.com says...
echo "<form target=\"checkblank.php\" method=\"post\">";
echo '<form action="checkblank.php" method="post">';

<cue doh!>
2. Can anybody suggest a quick and easy way to strip arrays? stip_tags is
fine with variables, but converts arrays to variables. I'd like to use it
for the sake of security though. I don't particularly want to translate the
array into a whole lot of variables, as it's a big array.


Have used a call to a user-defined function within array_walk to alter all
values in an array, can't see why you could do it also with inbuilt
functions like strip_tags but I haven't tried it out.

Geoff M
Jul 17 '05 #2

P: n/a
Joe Blow (Jo*@Blow.com) decided we needed to hear...
Two questions late at night and going stir crazy. Anybody who takes pity on
me will have my undying gratitude and a virtual bottle of beer.
I've tried to look them both up on the php.net, and elsewhere, but without
success.

1. Am writing a php program which checks entries in a form on a previous
page. It then asks for any empty fields to be filled, and submits the
resulting form back to itself to check it again.

In other words the file "checkblank.php" includes this line within the php:

echo "<form target=\"checkblank.php\" method=\"post\">"; instead, use...
echo "<form action='checkblank.php' method='post' target='_self'>";

When the form is submitted it opens in a new window (in FireFox). In Firefox
it is not a disaster as the variables and arrays are not lost, and the
program works, but popups are not something I like. In IE the whole thing
collapses in a heap as the variables appear not to be passed to the new
window. Needless to say, the vast majority of users will have IE. Is there a
reason I'm unaware of, and can it be stopped easily?

2. Can anybody suggest a quick and easy way to strip arrays? stip_tags is
fine with variables, but converts arrays to variables. I'd like to use it
for the sake of security though. I don't particularly want to translate the
array into a whole lot of variables, as it's a big array.

something like...
foreach (array_keys($array_to_strip) as $akey) {
$array_to_strip[$akey] = strip_tags($array_to_strip[$akey]);
}
or use array_walk or array_walk_recursive

--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)
Jul 17 '05 #3

P: n/a
Many thanks indeed.
"Dave" <da**@REMOVEbundook.com> wrote in message
news:2e************@fawlty.homelinux.net...
Joe Blow (Jo*@Blow.com) decided we needed to hear...
Two questions late at night and going stir crazy. Anybody who takes pity
on
me will have my undying gratitude and a virtual bottle of beer.
I've tried to look them both up on the php.net, and elsewhere, but
without
success.

1. Am writing a php program which checks entries in a form on a previous
page. It then asks for any empty fields to be filled, and submits the
resulting form back to itself to check it again.

In other words the file "checkblank.php" includes this line within the
php:

echo "<form target=\"checkblank.php\" method=\"post\">";

instead, use...
echo "<form action='checkblank.php' method='post' target='_self'>";

When the form is submitted it opens in a new window (in FireFox). In
Firefox
it is not a disaster as the variables and arrays are not lost, and the
program works, but popups are not something I like. In IE the whole thing
collapses in a heap as the variables appear not to be passed to the new
window. Needless to say, the vast majority of users will have IE. Is
there a
reason I'm unaware of, and can it be stopped easily?

2. Can anybody suggest a quick and easy way to strip arrays? stip_tags is
fine with variables, but converts arrays to variables. I'd like to use it
for the sake of security though. I don't particularly want to translate
the
array into a whole lot of variables, as it's a big array.

something like...
foreach (array_keys($array_to_strip) as $akey) {
$array_to_strip[$akey] = strip_tags($array_to_strip[$akey]);
}
or use array_walk or array_walk_recursive

--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)

Jul 17 '05 #4

P: n/a
"Dave" <da**@REMOVEbundook.com> wrote in message
news:2e************@fawlty.homelinux.net...
Joe Blow (Jo*@Blow.com) decided we needed to hear...
Two questions late at night and going stir crazy. Anybody who takes pity
on
me will have my undying gratitude and a virtual bottle of beer.
I've tried to look them both up on the php.net, and elsewhere, but
without
success.

1. Am writing a php program which checks entries in a form on a previous
page. It then asks for any empty fields to be filled, and submits the
resulting form back to itself to check it again.

In other words the file "checkblank.php" includes this line within the
php:

echo "<form target=\"checkblank.php\" method=\"post\">";

instead, use...
echo "<form action='checkblank.php' method='post' target='_self'>";

When the form is submitted it opens in a new window (in FireFox). In
Firefox
it is not a disaster as the variables and arrays are not lost, and the
program works, but popups are not something I like. In IE the whole thing
collapses in a heap as the variables appear not to be passed to the new
window. Needless to say, the vast majority of users will have IE. Is
there a
reason I'm unaware of, and can it be stopped easily?

2. Can anybody suggest a quick and easy way to strip arrays? stip_tags is
fine with variables, but converts arrays to variables. I'd like to use it
for the sake of security though. I don't particularly want to translate
the
array into a whole lot of variables, as it's a big array.

something like...
foreach (array_keys($array_to_strip) as $akey) {
$array_to_strip[$akey] = strip_tags($array_to_strip[$akey]);
}
or use array_walk or array_walk_recursive

--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)


By the way, I am using a really terrible and out of date book as a guide
while I get familiar with PHP. It's led me astray a few times.

According to it, there is no difference between ' and \". Does it have an
effect? Or am I missing something in the HTML?

JB
Jul 17 '05 #5

P: n/a
Joe Blow (Jo*@Blow.com) decided we needed to hear...
<snip>
By the way, I am using a really terrible and out of date book as a guide
while I get familiar with PHP. It's led me astray a few times.

According to it, there is no difference between ' and \". Does it have an
effect? Or am I missing something in the HTML?

JB

AFAIK for plain HTML there isn't a difference between single and double
quotes - as long as they're used consistently - I just prefer single.
As far as PHP is concerned using one or the other determines (amongst
other things) if vars will be interpolated. I tend to use single quotes
by default, until double are required.
You can read all of the gory details(!) here:
http://www.php.net/manual/en/language.types.string.php
--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)
Jul 17 '05 #6

P: n/a
Oh boy, I was having a bad night last night.

I have only just realised that I had '<form action=...' instead of <form
target='.

D'oh indeed.

JB

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.