when i use <?php echo $_SERVER; ?> in my forms the get values disappears. How to fix that? Is there some function?

Recommended Answers

All 5 Replies

sorry need more information and some code examples on your problem also to help you

I just talked to a friend.

<form action="<?php echo $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']; ?>" method="POST">

alright first of all you wrote an echo function you do not use echo function for this type of print out because it will print out on the top of the document not where you want it to print out use the print() function this will work how you want it to

<form action="<?php print($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']); ?>" method="POST">

also when you are using the form action="" tag and it is sending all the information back to the same page with the same QUERY_STRING as what the page is currently without adding any other QUERY to the string then you should use this

<form method="POST">

by removing the action Attribute on the form tag it will auto resubmit all sending information back to the same page like you are doing with this

<form action="<?php print($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']); ?>" method="POST">

so the better line for faster loading when your send it back to the same script as what your on would be to use this

<form method="POST">

alright let me know if this helped and if you have any more questions just message me and ill try to help

alright first of all you wrote an echo function you do not use echo function for this type of print out because it will print out on the top of the document not where you want it to print out use the print() function this will work how you want it to

<form action="<?php print($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']); ?>" method="POST">

also when you are using the form action="" tag and it is sending all the information back to the same page with the same QUERY_STRING as what the page is currently without adding any other QUERY to the string then you should use this

<form method="POST">

by removing the action Attribute on the form tag it will auto resubmit all sending information back to the same page like you are doing with this

<form action="<?php print($_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']); ?>" method="POST">

so the better line for faster loading when your send it back to the same script as what your on would be to use this

<form method="POST">

alright let me know if this helped and if you have any more questions just message me and ill try to help

Great post.

your welcome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.