Jump to content

help a noob!


marco423

Recommended Posts

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:)

Link to comment
https://forums.phpfreaks.com/topic/197064-help-a-noob/
Share on other sites

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?

 

Link to comment
https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034484
Share on other sites

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"];

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034497
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/197064-help-a-noob/#findComment-1034510
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.