Jump to content

Explain nr 3?


eduard

Recommended Posts

  • Replies 239
  • Created
  • Last Reply
Does post 1 talk about more than one form?
For you is a form a simple thing; for me IT IS NOT!So ´yes´or ´no´ is all I asked for!
Link to comment
Share on other sites

Is this a correct html form?<html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' metod='post'>Description: <input type="text" name="description" id="desc"><br />Price: <input type="text" name="Price" id="Price" /><br />Quantity: <input type="text" name="Quantity" id="quantity" /></form></body></html> But how about the script php?<html><body><?php$txt="description";echo $txt;?></body></html>

Link to comment
Share on other sites

Nothing has just got up, and gone! :) wheres<?phpif (isset($_POST['fname']) && isset($_POST['lname'])) { echo "Your name is ".$_POST['fname']." ".$_POST['lname'];} else { echo "Invalid submission.";}?>shadowmage explained that you require a script similar to above to read the values from form, and you just ignore this, and ask if $txt="description";echo $txt;will do? compare the two, what do you think, seriously.

Link to comment
Share on other sites

You're asking me if this form is the form talked about in point 2. I'm saying that post 1 only talks about a single form, so yes, this is that form. There's only one, and this is it.Is that clear?
Very clear!
Link to comment
Share on other sites

Nothing has just got up, and gone! :) wheres<?phpif (isset($_POST['fname']) && isset($_POST['lname'])) { echo "Your name is ".$_POST['fname']." ".$_POST['lname'];} else { echo "Invalid submission.";}?>shadowmage explained that you require a script similar to above to read the values from form, and you just ignore this, and ask if $txt="description";echo $txt;will do? compare the two, what do you think, seriously.
NO, I DIDN´T ASK IF THIS WILL DO; OF COURSE IT WON´T! AND I DIDN´T IGNORE IT! IT DIDN´T WORK, THEREFORE I TOOK SOME STEPS BACK ($TXT)!
Link to comment
Share on other sites

If$txt="description";echo $txt;is obviously not going to work? and you say you know it won't work (yeah right) , then why use it as example and say 'But how about the script php?' implying it should work, after been told in #2,#3, #25, #35, #42 that you should be using php post as in '"$_POST['description']", and it is not anywhere in your script, IMPLIES to me that you totally ignore our answers. You then, because the script does not work for you, conclude 'it must be wrong' and revert to a script that will in no circumstance, what's so ever work, and apparently know won't work, does this not seem MAD! or what!LOOK AT FORM PAGE, LOOK AT FORM ELEMENT, and check the attribute names as in "metod"?. This is why your values are NOT being sent to the the php script, that's is why your script does not to read the values in the script page (IF! and only IF you used "$_POST['description']" to read description value sent from the form).

Link to comment
Share on other sites

If$txt="description";echo $txt;is obviously not going to work? and you say you know it won't work (yeah right) , then why use it as example and say 'But how about the script php?' implying it should work, after been told in #2,#3, #25, #35, #42 that you should be using php post as in '"$_POST['description']", and it is not anywhere in your script, IMPLIES to me that you totally ignore our answers. You then, because the script does not work for you, conclude 'it must be wrong' and revert to a script that will in no circumstance, what's so ever work, and apparently know won't work, does this not seem MAD! or what!LOOK AT FORM PAGE, LOOK AT FORM ELEMENT, and check the attribute names as in "metod"?. This is why your values are NOT being sent to the the php script, that's is why your script does not to read the values in the script page (IF! and only IF you used "$_POST['description']" to read description value sent from the form).
In the tutorials are written: EXAMPLES! So is this an EXAMPLE!Of course, I am not going to use an EXAMPLE!P. s. I don´t LOOK at the tutorials, I STUDY them (now!)
Link to comment
Share on other sites

Is this a correct html form?<html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' metod='post'>Description: <input type="text" name="description" id="desc"><br />Price: <input type="text" name="Price" id="Price" /><br />Quantity: <input type="text" name="Quantity" id="quantity" /></form></body></html> But how about the script php?<html><body><?php$txt="description";echo $txt;?></body></html>
if you don't plan on using them together than they're OK, but if you're trying replicate the examples that we've given you of how a form and form handling script would work together, then it doesn't appear you've been listening, or get it, or whatever. Not only are there mistakes in your HTML (method), there's no connection between the form and the script whatsoever. Where's the stuff about POST? if you took my advice then the most basic thing you would need in the script is to output $_POST, just to make sure it's working. like:
<?php var_dump($_POST);?>

but you're not even doing that, so I have no idea what your thinking. Instead of asking us if it will work, just freakin do it and try and fix it if it breaks, and then ask questions showing the code and what you tried. From what you come back with, it's like you haven't even listed to anything we've said.

Link to comment
Share on other sites

In the tutorials are written: EXAMPLES! So is this an EXAMPLE!Of course, I am not going to use an EXAMPLE!P. s. I don´t LOOK at the tutorials, I STUDY them (now!)
the whole point is to be able to replicate an example to the point of understanding it. why do you think we tell you to use the tutorials so often!? the point is the tutorials provide the documentation to understand the basics, from which you can add more knowledge to and learn from. good grief.... :)
Link to comment
Share on other sites

if you don't plan on using them together than they're OK, but if you're trying replicate the examples that we've given you of how a form and form handling script would work together, then it doesn't appear you've been listening, or get it, or whatever. Not only are there mistakes in your HTML (method), there's no connection between the form and the script whatsoever. Where's the stuff about POST? if you took my advice then the most basic thing you would need in the script is to output $_POST, just to make sure it's working. like:
<?php var_dump($_POST);?>

but you're not even doing that, so I have no idea what your thinking. Instead of asking us if it will work, just freakin do it and try and fix it if it breaks, and then ask questions showing the code and what you tried. From what you come back with, it's like you haven't even listed to anything we've said.

I should NOT have posted the php script, because I am NOT going to use it! It was an EXAMPLE!So, how about this file?<html><body><?phpif (isset($_POST['description'])) { echo "The description of this product is ".$_POST['description']; } else { echo "Invalid submission"; } ?></body></html>Is it correct? and if so: Where do I have to save it?(Now the output is: invalid, but I think it isn´t saved in the right place (now the MAMP folder!)
Link to comment
Share on other sites

no, it say's invalid because $_POST doesn't exist yet. You can save the file where ever you want within the webroot, as long you reference it correctly from the form. When you submit the form, the script will run and any form data sent will get initialized within the POST or GET array, depending on what was defined in the forms method attribute.. So... again...learn this, please!1) You create an HTML page with a form. The action attribute points to a script intended to process that form. The method sets the array to be used in the script; GET/POST.2) The script the form submits to handles the processing of the data. By itself it's really not useful. Thus, you want to hit submit from the form page and THEN see what happens.I've lost track of how many times we have explained this very basic and simple concept, so if you are still confused about why there is a separate HTML page and a separate script page, then please tell us. If you don't understand what each one is doing then please tell us. This is getting rather ridiculous (again...).

Link to comment
Share on other sites

no, it say's invalid because $_POST doesn't exist yet. You can save the file where ever you want within the webroot, as long you reference it correctly from the form. When you submit the form, the script will run and any form data sent will get initialized within the POST or GET array, depending on what was defined in the forms method attribute.. So... again...learn this, please!1) You create an HTML page with a form. The action attribute points to a script intended to process that form. The method sets the array to be used in the script; GET/POST.2) The script the form submits to handles the processing of the data. By itself it's really not useful. Thus, you want to hit submit from the form page and THEN see what happens.I've lost track of how many times we have explained this very basic and simple concept, so if you are still confused about why there is a separate HTML page and a separate script page, then please tell us. If you don't understand what each one is doing then please tell us. This is getting rather ridiculous (again...).
Here´s my html form (I finished it yesterday!):<html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' metod='post'>Description: <input type="text" name="description" id="desc"><br />Price: <input type="text" name="Price" id="Price" /><br />Quantity: <input type="text" name="Quantity" id="quantity" /></form></body></html>
Link to comment
Share on other sites

:) I'd like to remind you (again!) how the whole process goes:
Apache takes input from the user's HTTP request, and gives output back to the user in the form of an HTTP response.Before fully giving the output to the user, Apache starts PHP giving to it the HTTP request as input, and waits to get an HTTP response.Before fully giving the output to Apache, PHP could (if you instruct it to) give to MySQL input in the form of an SQL query, and MySQL could give the so called result set as output back to PHP. PHP could do this 0, 1, 2 or more times.After taking a result set as input from MySQL, PHP can use it for anything, like outputting something back to Apache based on whatever is the result set.THAT IS IT! ALL OF IT! Everything else about databases comes down to this.
Read that again...Did you read it? Don't say you remember it! Go back, and reread it!Read it now? OK, so... what does this have to do with the form and everything here you ask? When a user submits an HTML form, the data they entered into the form becomes part of the HTTP request Apache receives.No, seriously. Reread the above again, especially now that you just read the previous sentence.The "action" attribute on an HTML form is the URL to which an HTTP request will be made.Depending on what the "method" attribute says, the data will be in a different part of the HTTP request, with different implications by each method. See the PHP tutorials on GET and POST to see the differences between the two methods.
Link to comment
Share on other sites

the whole point is to be able to replicate an example to the point of understanding it. why do you think we tell you to use the tutorials so often!? the point is the tutorials provide the documentation to understand the basics, from which you can add more knowledge to and learn from. good grief.... :)
What do you think I am doing? Studying (= NOT LOOKING!) the tutorials!
Link to comment
Share on other sites

:) I'd like to remind you (again!) how the whole process goes:Read that again...Did you read it? Don't say you remember it! Go back, and reread it!Read it now? OK, so... what does this have to do with the form and everything here you ask? When a user submits an HTML form, the data they entered into the form becomes part of the HTTP request Apache receives.No, seriously. Reread the above again, especially now that you just read the previous sentence.The "action" attribute on an HTML form is the URL to which an HTTP request will be made.Depending on what the "method" attribute says, the data will be in a different part of the HTTP request, with different implications by each method. See the PHP tutorials on GET and POST to see the differences between the two methods.
Here is my script.php<html><body><?phpif (isset($_POST['description'])) { echo "The description of this product is ".$_POST['description']; } else { echo "Invalid submission"; } ?></body></html>(P. s. Unfortunately you didn´t answer my question where I do have to save it!
Link to comment
Share on other sites

Unfortunately you didn´t answer my question where I do have to save it!
This looks like an answer to that question to me:
You can save the file where ever you want within the webroot, as long you reference it correctly from the form.
OK, let's start from square one:You have your html form:
<html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' metod='post'>Description: <input type="text" name="description" id="desc"><br />Price: <input type="text" name="Price" id="Price" /><br />Quantity: <input type="text" name="Quantity" id="quantity" /></form></body></html>

Problem is, you're missing a key part: the submit button. Put this line after the quantity input:<input type='submit' value='Submit' />Now if you have your script.php file saved in the same location as this HTML file, when you click on the submit button, it will submit the data you entered in the form to script.php will then process the request and show you your output.

Link to comment
Share on other sites

This looks like an answer to that question to me:OK, let's start from square one:You have your html form:
<html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' metod='post'>Description: <input type="text" name="description" id="desc"><br />Price: <input type="text" name="Price" id="Price" /><br />Quantity: <input type="text" name="Quantity" id="quantity" /></form></body></html>

Problem is, you're missing a key part: the submit button. Put this line after the quantity input:<input type='submit' value='Submit' />Now if you have your script.php file saved in the same location as this HTML file, when you click on the submit button, it will submit the data you entered in the form to script.php will then process the request and show you your output.

Sorry, I missed the second (most important!) part of your reply!
Link to comment
Share on other sites

This looks like an answer to that question to me:OK, let's start from square one:You have your html form:
<html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' metod='post'>Description: <input type="text" name="description" id="desc"><br />Price: <input type="text" name="Price" id="Price" /><br />Quantity: <input type="text" name="Quantity" id="quantity" /></form></body></html>

Problem is, you're missing a key part: the submit button. Put this line after the quantity input:<input type='submit' value='Submit' />Now if you have your script.php file saved in the same location as this HTML file, when you click on the submit button, it will submit the data you entered in the form to script.php will then process the request and show you your output.

Succeeded!Now I have to write an INSERT query (SQL)?
Link to comment
Share on other sites

your form's method is still spelled incorrectly...and before you do anything with MySQL, have you verified your form is working and that you can see the values?

Link to comment
Share on other sites

your form's method is still spelled incorrectly...and before you do anything with MySQL, have you verified your form is working and that you can see the values?
Yes, it isn´t finished yet! But can I upload the (improved, unfinished) files? I´ve to show my family something!Allright?<html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' metod="post">Description: <input type="text" name="description" id="desc"><br />Price: <input type="text" name="Price" id="Price" /><br />Quantity: <input type="text" name="Quantity" id="quantity" /><input type='submit' value='Submit' /></form></body></html>
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...