Okay, I figured out how to print hello world, now I want to build on this, but cant find tutorials to do so because I dont know what the function is called. I want to be able to have something that gives me the option to type in "hello world" in the browser, and then have it return "hello world", or whatever else I input into it... (like if I input Whats up!, it says Whats up! rightback...) I dont know what this script is called! Thanks!
Do you mean something like: <?php if($_POST['submit'] && !empty($_POST['text'])) { echo $_POST['text']; } else { echo "<form method='POST'>Text: <input type='text' name='text'><br /><input type='submit' name='submit'></form>"; } ?> PHP:
precicesly! Thank you... okay I need to learn about how/why it does what it does now cause that is much different than <?php print "hello world ?> also just curious, when I run that code it says this: does that just mean that it deosnt have anywhere to submit it to so its like wooooah what is going on here? (is that an error, or just a note saying that there is nowhere for the input to be stored, except to spit it back out at you) Edit to add: this may sound like a realllly dumb question but how do you make these symbols: ||
The code below will fix that error. <?php if(isset($_POST['submit']) && !empty($_POST['text'])) { echo $_POST['text']; } else { echo "<form method='POST'>Text: <input type='text' name='text'><br /><input type='submit' name='submit'></form>"; } ?> PHP: The | character is right below the backspace key.
You rock!!! (omg feeling like a doof, I didnt know that key existed ! lol) Now , why was it showing that error before and not now? The only thing I think that changed was the " isset" part... I have noooo idea what that is or what it does lol (thanks for all your help!)
It's because the string had no value to it. isset is checking that the string has a value before beginning to do the work.