Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.