fourm data to variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

fourm data to variables

How would I go about putting data (strings) in the url and then going to that url after a user has entered data into a fourm? My idea is a fourm that only has a subject, a message box and a submit button that after pressing will take the user to a url that is subject+message with underscores instead of spaces. All i really need help with is directing the information from the fourm into variables from a html page the rest I can do by hand.

31st Jan 2018, 6:06 PM
SeeGreatness
SeeGreatness - avatar
2 Answers
+ 1
function click() { var sub = getElementById(”subject”).val; var msg = getElementById(”message”).val sub = sub.split(” ”).join(”_”); msg = msg.split(” ”).join(”_”); window.location.href(”new url”); } I didn’t understand what kind of url you wanted but there’s subject and message in their own variables with underscores instead of spaces. And the redirect function
31st Jan 2018, 11:51 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
@Toni Isotalo Here is my code https://code.sololearn.com/W15ZFBWuL37c/?ref=app I do not know what is wrong but I have a better explanation of what I’m trying to do (it’s all for this app I got for notifications) and I don’t actually need underscores for spaces I could use the url scheme for a space without using a space (I think that would work I’m actually not sure)
1st Feb 2018, 2:48 AM
SeeGreatness
SeeGreatness - avatar