Hi there

I'm having some problems with my form. I'm generating my form through php and I can't quite figure out how to echo <?= $_SERVER?> for the action in my form tag.

at the moment what I have is this:

echo "<form name=\"tsgh_add\" method=\"post\"  action=\""; ?><?= $_SERVER['PHP_SELF']?><? echo "\" onSubmit=\"return checkWholeForm(this);\">";

I've tried other variations that I thought might work but haven't succeeded. Any help would be greatly appreciated.

P.S. I'd like to keep the person on the page they're submitting the form on so any solution for doing this is welcome.

10 Years
Discussion Span
Last Post by nav33n

You dont need <?= because you are already echoing something ! You can do this.

echo "<form name=\"tsgh_add\" method=\"post\"  action=".$_SERVER['PHP_SELF']." onSubmit=\"return checkWholeForm(this);\">";
Votes + Comments
Rocking! I initially thought of that myself but because my submit button's type was wrong I thought that I was wrong :P

Thank you nav33n. It initially didn't work but then I thought there must be something wrong because you're generally right 99.9999999% of the time and I found that the type of my submit button was "button" and not "submit" :P


Check the sourcecode of the html. See what the form tag contains ! There must be something wrong !

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.