0

Is there a way to append/preppend something to the data sent with <form method="post"> with html? Explanation: a user enters "Hello World" into a <textarea> element with name="textArea1". Is it now possible to write the html so that the server receives:

$_POST['textArea1'] == 'This sentence was prepended with html. Hello World';

I know how to do this with js, I am just curious if there is a way to do this with just plain html. If this is not possible, is there a way to send along the script name that made the post request?

1 Answer 1

3

If you're good using PHP to append/prepend, use this:

$var = 'prepend... '.$_POST['textArea1'].'... and append';

As you stated in your post it's possible with JS. It's not possible with only HTML.

Sign up to request clarification or add additional context in comments.

7 Comments

Yes use dot to concatenate string as Mooseman did and use single quote for better parsing.
PHP is not an option. I won't know in advance what script will receive the data since I am using autoloading.
@DudeOnRock 1) Why did you use $_POST['textArea1'] if you're not using PHP? 2) It's not possible with only HTML.
@Mooseman: That is what I am asking: IS it possible. I used $_POST['textArea1'] to clarify what I want to receive inside my php script. The script can't know what I want to append to the data.
@Mooseman: I removed my downvote, since your answer now addresses my question. Thanks!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.