Jump to content
L8V2L

Return value is null

Recommended Posts

<form action="/submit" method="post">    <input type="text" name="sometext">    <input type="submit" value="Upload"></form>
Does forum does not return the value that is input in to it back to the server.Am I missing anything?

Share this post


Link to post
Share on other sites

This was instruction I was following from a book... I don't believe they will not inform me of everything I must do.And looking in w3s I don't see much information... but this:Submit Button

<input type="submit"> //defines a submit button.//A submit button is used to send form data to a server. The data is sent to the page specified in the form's action //attribute. The file defined in the action attribute usually does something with the received input:<form name="input" action="demo_form_action.asp" method="get">Username: <input type="text" name="user"><input type="submit" value="Submit"></form> 

Share this post


Link to post
Share on other sites

So what is on the server side?

Share this post


Link to post
Share on other sites

a file name submit... but before that I was handling everything in one file with port listing on 8080, but after reading w3s I separate the code, and have it listening on 8181 port... should it be listing on the same port?the logic behind it is if the page is requested, check to see if this page have a /submit post request, if not, than return a forum page. If the url does contain a /submit in it, extract the data from the request body and log it to the terminal.

Share this post


Link to post
Share on other sites

The action attribute of the form has to have a reference to a page with a script that will process the form data. What script is processing the form data?

 

Forget ports, they have nothing to do with form submission.

Share this post


Link to post
Share on other sites

Another side question:In computing, a symbolic link (also symlink or soft link) is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.So can an xhtml page be seen as an symbolic?including that it have link and anchor tags to link to other files; like js files, image files, video files, and etc.Just won't clarity please. And if you could give a little of your own words on this... Please indicate that what I suggest to be correct by saying yes or no follow by a description giving a little information on why... Thank you.

Share this post


Link to post
Share on other sites

The action attribute of the form has to have a reference to a page with a script that will process the form data. What script is processing the form data?

So what you are saying is that the submit button is sending the information off to another page that is specify by the action attribute?the script is on the same page as the server logic, but that did not fully work, so after reading w3s I move it to another file name form... but... That does not seem to be working....---later in the future.--So it was an error syntax that was not detected do to it being in the a string being sent to the web browser....but it only returning to that server that sent it, and not to the file that the action=submit" point to. --by the way it was this that was the error for I had it like this: action"submit", go ahead and laugh, and please refer to pic-- Why? Do I need an absolute path for this to work?

Share this post


Link to post
Share on other sites

The form sends the data to another page. That page does something with the form data. The code that does it has to be written with a server-side language, such as PHP or ASP.NET.

 

If you don't have a page with server-side code then the form will do nothing.

Share this post


Link to post
Share on other sites

The form sends the data to another page. That page does something with the form data. The code that does it has to be written with a server-side language, such as PHP or ASP.NET. If you don't have a page with server-side code then the form will do nothing.

yes, I have that, but when I press submit, it return the data back to the server that first serve the form to the client. I have another server running to accept that data in the file name submit, but it does not send that data to be posted...

Share this post


Link to post
Share on other sites

thinking of this in the logic matter, there have to be another server running to be able to accept the data right?

Share this post


Link to post
Share on other sites

main form

<form action="/submit" method="post">    <input type="text" name="sometext">    <input type="submit" value="Upload"></form>

because this has no php code can be .html, .html as well as php, I also presume that because you have not stated .php extension, you are using htaccess to point to submit.php when it comes across /submit url No? well it won't work then.

 

submit.php (very basic)

<!DOCTYPE html><html>    <head>        <meta charset="UTF-8">        <title>Response from form</title></head<body><p><?phpif(isset($_POST['sometext']) && !empty($_POST['sometext'])){echo 'sometext from form: '.$_POST['sometext'].'<br>';}else{echo 'Errr Nope! nada sent or received this time';}?></p></body></html>

Same location than main form file, same server.

Edited by dsonesuk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×