marco423 Posted March 31, 2010 Share Posted March 31, 2010 Ok im a noob at this im not going to lie. My senior project is to create a very primitive social networking website. Im in way over my head but ill be fine. But my first problem is when i have an html file linked to a php file, only the stuff coded in html will show up thats on the php file. Am i doing something wrong or is this just not possible. Any help will be greatly appreciated:) Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/ Share on other sites More sharing options...
Jax2 Posted March 31, 2010 Share Posted March 31, 2010 Can you be a bit more specific? Give an example? Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034476 Share on other sites More sharing options...
marco423 Posted March 31, 2010 Author Share Posted March 31, 2010 i a php file, it links to an html file, everything appears as it should. Then i have a link from the html back to a php file. No php code will show up, only html coding will show up Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034478 Share on other sites More sharing options...
Jax2 Posted March 31, 2010 Share Posted March 31, 2010 Unless I am mistaken (and someone please point out if I am), .html files are not parsed for PHP code unless you specifically tell your server to do so in your .htaccess file. In other words, it doesn't recognize the php code. The opposite, however, is not true - html code can be used inside .php files, so why not just make them all .php's? Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034484 Share on other sites More sharing options...
marco423 Posted March 31, 2010 Author Share Posted March 31, 2010 ok i changed them all to .php, im using html code though to link to the php file. when i run the regular php file, everything shows up like it is supposed to. but when i click the link only html code shows up Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034487 Share on other sites More sharing options...
marco423 Posted March 31, 2010 Author Share Posted March 31, 2010 ok i figured out that for some reason my code is not passing the stuff right? heres my code for my sign up page: <form action="yo.php" method="post" > First Name: <input type="text" name="fname" /></br> Last Name: <input type="text" name="lname" /></br> Age: <input type="text" name="age" /></br> Email: <input type="text" name="email" /></br> Username: <input type="text" name="userName"/></br> Password: <input type="text" name="password"/></br> <INPUT TYPE="submit" VALUE="Sign me Up!"> and my code for yo.php: <?php print $_POST["fname"]; print $_POST["age"]; ?> Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034497 Share on other sites More sharing options...
teamatomic Posted March 31, 2010 Share Posted March 31, 2010 Nothing wrong with your code. If you were to put it all in a page named yo.php it would print out the fname and age. What error are you getting? HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034500 Share on other sites More sharing options...
marco423 Posted March 31, 2010 Author Share Posted March 31, 2010 for some reason when i click submit a download box comes up and asks to save or open. is this supposed to happen? Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034502 Share on other sites More sharing options...
teamatomic Posted March 31, 2010 Share Posted March 31, 2010 Put this in a page by itself and call it in your browser: <?php echo "hello"; ?> What happens? HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034506 Share on other sites More sharing options...
marco423 Posted March 31, 2010 Author Share Posted March 31, 2010 if i put that in, it simply prints out hello Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034508 Share on other sites More sharing options...
oni-kun Posted March 31, 2010 Share Posted March 31, 2010 Try this, And make sure the method is correctly named as so: <form action="yo.php" method="POST" > First Name: <input type="text" name="fname" /></br> Last Name: <input type="text" name="lname" /></br> Age: <input type="text" name="age" /></br> Email: <input type="text" name="email" /></br> Username: <input type="text" name="userName"/></br> Password: <input type="text" name="password"/></br> <input type="submit" value="Sign me Up!"> </form> yo.php: <?php //Print all $_POST elements foreach ($_POST as $array) { print $array . "<br/>\n"; } ?> This should work fine and work for debugging, Just read up on PHP tutorials if you want to learn the basics of PHP forms, it doesn't seem like you know all that much so far. Quote Link to comment https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034510 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.