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.

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);\">";
commented: Rocking! I initially thought of that myself but because my submit button's type was wrong I thought that I was wrong :P +1

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

lol..

EDIT: nvm, i was once again being a noob.

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

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.