using php how to echo html inputs onto a profile page
9 replies, posted
like this page, you type in stuff and it comes up when you press post.
how do i make a profile like myspace where users can type in information about them and it echos it. the only thing i dont understand is the input name, would it be echo "['username']"; etc.. ?
You have to store it in a database.
<?php
mysql_connect("localhost", "*****", "***********") or die(mysql_error());
mysql_select_db("****") or die(mysql_error());
mysql_query("INSERT INTO
")
or die(mysql_error());
echo "Data Inserted!";
?>
how would i do that?
If you make an HTML form that points to your PHP script, you can get the values of the form fields with $_REQUEST['name'], $_REQUEST['age'], etc. -- corresponding to whatever <input> elements you had in your form. You can use this to make a page that incorporates the information that the user submitted, but it's not saved anywhere: if you want to see the same page again, you have to submit all the same information again.
To let the user submit their profile information and then use it later to display the page to others, you have to save it somewhere, typically in a database as Ortzinator said. This isn't just a matter of someone telling you what commands to type in your script; you need to learn a bit about SQL in order to design your database tables to hold the information you want.
Just query age, name, info etc and post it as vars?
Or row etc.
Ah, i used md5 because i though he didn't know what sha1 was.
Dude, it's just a little annyoing to see a PHP question here that can be answered by simply googling. I'm not trying to sound like an asshole but for like the 4th time, learn to use [php] tags and google for answers. It's not terribly difficult. :v:
Also, PHP is one of the most documented languages, just search php.net and you'll find it.
Sorry, you need to Log In to post a reply to this thread.