/    Sign up×
Community /Pin to ProfileBookmark

How To Post to $_SERVER[‘PHP_SELF’] ?

Folks,

I knew this was wrong but still did it.

[code]
<form method = ‘POST’ action = “$_SERVER[‘PHP_SELF’]”>
[/code]

I get taken to:
http://localhost/Templates/$_SERVER[‘PHP_SELF’]

Anyway, I usually come across people doing it like this …

[code]
<form method = ‘POST’ action = “”>
[/code]

Do you do it like this or what ?

Anyway, I was told to do it like this ….

[code]
<form method = ‘POST’>
[/code]

What’s your opinion ? Should I stick to this one or the one just above it ?

**EDIT:**
Silly me!
Ofcourse this is wrong ….

[code]
<form method = ‘POST’ action = “$_SERVER[‘PHP_SELF’]”>
[/code]

Should be …

[code]
<form method = ‘POST’ action = “<?php echo $_SERVER[‘PHP_SELF’]?>”>
[/code]

Nevertheless, I’d like someone to answer my previous post.

Thanks!

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@developer_webauthorJul 09.2021 — Silly me!

Ofcourse this is wrong ....

<i>
</i>&lt;form method = 'POST' action = "$_SERVER['PHP_SELF']"&gt;


Should be ...
<i>
</i>&lt;form method = 'POST' action = "&lt;?php echo $_SERVER['PHP_SELF']?&gt;"&gt;


Nevertheless, I'd like someone to answer my previous post.

Thanks!
Copy linkTweet thisAlerts:
@developer_webauthorJul 18.2021 — Still waiting for peoples' opinions.
Copy linkTweet thisAlerts:
@developer_webauthorJul 18.2021 — No feed-back ?
Copy linkTweet thisAlerts:
@developer_webauthorJul 23.2021 — @DaveyErwin

Any inputs you can give here ?
×

Success!

Help @developer_web 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.19,
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,
)...