aikorei Posted March 20, 2013 Share Posted March 20, 2013 I'll throw you all a softball, since I'm sure this has to be easy and I'm just daft... All I'm trying to do is create an html form that posts data to a php file on my server. But the php file isn't a webpage. It's just a file in one of my subfolders. When I put what I believe the absolute url to the file on my server in as the action, it brings me to a blank white page and nothing happens. I believe I get the concept of using $_POST to get the information and handle it....but how do I get it to the file? Quote Link to comment https://forums.phpfreaks.com/topic/275892-html-form-action-posting-to-php-file/ Share on other sites More sharing options...
davidannis Posted March 20, 2013 Share Posted March 20, 2013 (edited) <form action="myfolder/myphpfilename.php" method="POST"> <input type="text" name="myfieldname"> .... many more fields here if you need them. <input type="submit"> </form> To see something when you access your php file you need the php to output something. Try adding this code echo 'Hi there <br />'; echo $_POST['myfieldname']; to see how it works. Edited March 20, 2013 by davidannis Quote Link to comment https://forums.phpfreaks.com/topic/275892-html-form-action-posting-to-php-file/#findComment-1419721 Share on other sites More sharing options...
Solution aikorei Posted March 20, 2013 Author Solution Share Posted March 20, 2013 (edited) I just realized that my php errors were printing to an error_log I didn't realize I had (in a different folder than the main error_log I usually check). There was a syntax error that was blocking the file from loading right. I had been trying to echo something to the page, and it wasn't working...now it is. I guess the right syntax makes a difference. =P Thanks for the help anyhow! Edited March 20, 2013 by aikorei Quote Link to comment https://forums.phpfreaks.com/topic/275892-html-form-action-posting-to-php-file/#findComment-1419723 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.