Jump to content

Explain nr 3?


eduard

Recommended Posts

Yes, it isn´t finished yet! But can I upload the (improved, unfinished) files? I´ve to show my family something!
How about you show them all of your forum topics too? Even if no (pseudo something resembling an) app is working, they'll at least see you're trying.
Link to comment
Share on other sites

  • Replies 239
  • Created
  • Last Reply
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>
METHOD is spelled wrong (still... :))i don't see the point of uploading a form that doesn't do anything. have you tried submitting the form to see if it touches your script.php?edit: this was the entirety of the second part of step 3
b ) PHP/SQL - once you have the form submitting to the PHP script, and you can view all the data, you are ready to write an INSERT query to submit the information to the database* http://www.w3schools.com/php/php_mysql_insert.asp
it was written in that order for a reason. the INSERT step should come after you have successful form submission based on meeting that criteria.
Link to comment
Share on other sites

How about you show them all of your forum topics too? Even if no (pseudo something resembling an) app is working, they'll at least see you're trying.
Good idea! But how do I do that?
Link to comment
Share on other sites

METHOD is spelled wrong (still... :))i don't see the point of uploading a form that doesn't do anything. have you tried submitting the form to see if it touches your script.php?
Thanks! You were right!
Link to comment
Share on other sites

Good idea! But how do I do that?
If the link thescientist gave stops working (which is to be expected... long story), you can do it like this:1. As you're reading this topic, hover over your username.2. Click on the arrow or the empty space that appears.3. Click on "Find Member's Topics".
Link to comment
Share on other sites

How do you ´quote´? (seriously, I, ve tried it several times, but I didn´t succeed!)
there's a quote button attached to every person's post. click it, and then when you reply, it will appear in the comment box.or you can just hit reply to the specific post you want to quote.
Link to comment
Share on other sites

http://w3schools.invisionzone.com/index.ph...mp;highlite=%2Bwow....6 pages. you definitely get an A for... something.
Yes, I know! I prefer reading (newspapers, books, etc.), listening music, drinking coffee, beer, etc., eating ....., watching tv, nature and women, etc. But with that I can´t get an A (unfortunately!)
Link to comment
Share on other sites

there's a quote button attached to every person's post. click it, and then when you reply, it will appear in the comment box.What I don´t understand if I click the ´quote´ button, it changes from + to -or you can just hit reply to the specific post you want to quote.
Link to comment
Share on other sites

right. if you read the whole sentence, you'll see it's a two parter.

there's a quote button attached to every person's post. click it, and then when you reply, it will appear in the comment box
if you hit quote, and add reply at the bottom of the page, then that's one way. (in this way you can quote multiple posts in your reply)if you just hit reply, that's another way.edit: it also changes color, as well as from + to -. It's just a visual toggle indicator.
Link to comment
Share on other sites

Where do I have to save these files and I assume that they must be uploaded?<html><body><?phpif (isset($_POST['description'])) { echo "The description of this product is ".$_POST['description']; } else { echo "Invalid submission"; } if (isset($_POST['price'])) { echo "The price of this product is ".$_POST['price']; } else { echo "Invalid submission"; } if (isset($_POST['quantity'])) { echo "The quantity of this product is ".$_POST['quantity']; } else { echo "Invalid submission"; } ?></body></html><html><head><style type="text/css">#desc{width:10%;height:5%;}</style><title>POST</title></head><body><form action='script.php' method="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

Where do I have to save these files and I assume that they must be uploaded?
Apparently, you didn't really read your replies:
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.
If you are using your own computer (ie, with MAMP) then you don't have to upload anything.If you are using a host then yes, you'll have to upload those files to your host.
Link to comment
Share on other sites

since you have MAMP, why not just try it on your computer. And you should know where to save your files by now.

Link to comment
Share on other sites

Apparently, you didn't really read your replies:This looks like an answer to that question to me:If you are using your own computer (ie, with MAMP) then you don't have to upload anything.If you are using a host then yes, you'll have to upload those files to your host.
I know about the script.php (I get now the message ´invalid´), but how about the html form?
Link to comment
Share on other sites

since you have MAMP, why not just try it on your computer. And you should know where to save your files by now.
Of course, I tried MAMP, but I got the message ´invalid´ Therefore my question!
Link to comment
Share on other sites

I know about the script.php (I get now the message ´invalid´), but how about the html form?
:)What is so hard about this concept?!We have told you time and time again that all of your files (HTML and PHP alike) need to be saved in your webroot...somewhere. It doesn't matter where as long as you are correctly referencing them when they need to be referenced.We've also told you (several times) that the PHP script by itself is useless unless you submit the form. Meaning you click on the submit button to send the form data to whatever script is in the action attribute, in this case script.php. So...if you are clicking submit, and still receive the "invalid" message, then there is something wrong. Most likely you are not using the correct names when trying to access the data in the $_POST array.
Link to comment
Share on other sites

sigh.....save your form and script.php in the same folder (IN THE WEBROOT!). open the form in a web browser and fill it out and hit submit. There you go. that's all you have to do. :)NOW, if you get invalid submission then you need to start debugging. I've explained how to show the whole post array on the screen, but putting this after the opening php tag

<?phpvar_dump($_POST);

if everything's there then you need to go through each if/else statement one by one. You might want to alter the invalid submission echo to include the key (price/description/quantity) so you can narrow down exactly which one is causing the error. for example, for description:

echo 'invalid submission because of description';

it has been mentioned already and explained in the tutorials, but here goes one more time:The POST members you are checking for in the script (price, quantity, description) needs to MATCH EXACTLY the name you give your form elements, which you've done using the name attribute. I repeat... the name of the form inputs and what you're looking for in POST need to MATCH EXACTLY.i.e.

<input type="text" name="description" id="desc">...if (isset($_POST['description'])){echo "The description of this product is ".$_POST['description'];}else{echo "Invalid submission";}

this one is right, but you need to check the other ones.

Link to comment
Share on other sites

:)What is so hard about this concept?!We have told you time and time again that all of your files (HTML and PHP alike) need to be saved in your webroot...somewhere. It doesn't matter where as long as you are correctly referencing them when they need to be referenced.We've also told you (several times) that the PHP script by itself is useless unless you submit the form. Meaning you click on the submit button to send the form data to whatever script is in the action attribute, in this case script.php. So...if you are clicking submit, and still receive the "invalid" message, then there is something wrong. Most likely you are not using the correct names when trying to access the data in the $_POST array.
What so strange to my question?To run php I have to save the php file in my MAMP folder!My html form is saved in my website folder (and this doesn´t run php!)I think it´s a logical question!
Link to comment
Share on other sites

the point is you should have everything for a project saved in the webroot (for more projects just create new folders for each project). That's why it called that. It's root for all your web related files/content for a project, and specifically, for all publicly available files.besides, how many times have we told you to put them in same folder anyway? what's illogical is not grouping related files (like all files used for a website) in the same folder. :) This is the same structure you're going to be dealing with when you go live. regardless of whether they are images, html files, or php, they are ALL going to be in a webroot folder.

Link to comment
Share on other sites

What so strange to my question?I think it´s a logical question!
Perhaps.....when you haven't been told the answer multiple times. :)
To run php I have to save the php file in my MAMP folder!My html form is saved in my website folder (and this doesn´t run php!)
:)Website folder? Everything you are using for your website should be in your MAMP webroot directory. There is no other "website folder".
Link to comment
Share on other sites

the point is you should have everything for a project saved in the webroot (for more projects just create new folders for each project). That's why it called that. It's root for all your web related files/content for a project, and specifically, for all publicly available files.besides, how many times have we told you to put them in same folder anyway? what's illogical is not grouping related files (like all files used for a website) in the same folder. :) This is the same structure you're going to be dealing with when you go live. regardless of whether they are images, html files, or php, they are ALL going to be in a webroot folder.
All this is clear to me! But how can I save a script.php in my website folder WITHOUT application or do I have to save my MAMP folder in my website folder?
Link to comment
Share on other sites

Clearly it's not clear. :)You have a webroot. ALL your files that are part of your website go into that folder (and for local testing you would probably want a separate folder for every project). Then you open the files in that folder from your web browser. I really don't understand whats not to get.example:

-webroot (/Applications/MAMP/htdocs)+ form.html+ script.php

I'm really lost at how else we can explain this to you. It's like you just forget everything you learned when you learn something new. You need to build upon previous knowledge if you ever expect to understand the bigger picture of developing and deploying websites.

Link to comment
Share on other sites

Clearly it's not clear. :)You have a webroot. ALL your files that are part of your website go into that folder (and for local testing you would probably want a separate folder for every project). Then you open the files in that folder from your web browser. I really don't understand whats not to get.example:
-webroot (/Applications/MAMP/htdocs)+ form.html+ script.php

I'm really lost at how else we can explain this to you. It's like you just forget everything you learned when you learn something new. You need to build upon previous knowledge if you ever expect to understand the bigger picture of developing and deploying websites.

I wrote many times that I´m just a beginner! Webroot? I don´r know well what it is (I´m sure I can find it at Google) But most of your replies are as I´m experienced and I´m not!I´ll give you an example that is clear for me:Imagine you have two files in the same folder of your web directory. One is an HTML file named form.html and the other is a PHP file named script.phpform.html has the following code:CODE<html><head><title>POST Example</title></head><body><form action='script.php' method='post'><input type='text' name='fname' /><input type='text' name='lname' /><input type='submit' value='Submit' /></form></body></html>script.php has the following code:CODE<?phpif (isset($_POST['fname']) && isset($_POST['lname'])) { echo "Your name is ".$_POST['fname']." ".$_POST['lname'];} else { echo "Invalid submission.";}?>Notice how the form's action attribute has the name of the PHP script in it. And the method attribute has a value of 'post' which means the data will be sent using the POST method and the data will be populated into the $_POST array in the PHP script.Also notice how the inputs' names match the indexes used to access the data in the $_POST array. Whatever name you give to your inputs will be the index you need to use to access its value in the $_POST or $_GET arrays.An HTML form submits to a PHP script. Until a submission has happened, you cannot access any information in the $_POST/$_GET array because it will not exist.So, I don´t agree with you that I forget all the things I´ve learned (some I do!), but also this I have written before, I get confused by many different replies-which mostly mean the same-but are written in a different way!
Link to comment
Share on other sites

Well, if you see a "conflict" in our replies to you (one says "do A", the other says "don't do A, do B"), then by all means quote the two replies and ask which one is better/correct. Many times however, what happens instead is you have someone tell you "do A", and another is telling you "do A or B". When there is "or", it means both things are correct... it's just that the person who told you "do A" either didn't know about B or (more likely) decided that A is all you need to know at this point.So... about the invalid thing... what exactly are you doing? Close all of your other browser windows, and describe what you do starting with you opening a new browser window.(I think I already know the answer, but for you to understand it, I need you to tell me in your own words what you doing, so that I may correct your actions)

Link to comment
Share on other sites

Well, if you see a "conflict" in our replies to you (one says "do A", the other says "don't do A, do B"), then by all means quote the two replies and ask which one is better/correct. Many times however, what happens instead is you have someone tell you "do A", and another is telling you "do A or B". When there is "or", it means both things are correct... it's just that the person who told you "do A" either didn't know about B or (more likely) decided that A is all you need to know at this point.So... about the invalid thing... what exactly are you doing? Close all of your other browser windows, and describe what you do starting with you opening a new browser window.(I think I already know the answer, but for you to understand it, I need you to tell me in your own words what you doing, so that I may correct your actions)
Sorry, I´m still asleep, but your idea about the ´conflicts´seem to me perfect!
Link to comment
Share on other sites

Archived

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


×
×
  • Create New...