Does anyone have any tutorials or code I can look at?
I am trying to create a file that will insert information from a web app into my database.
http://www.immortalsix.com/add_alumni.php is my basic schema of what I am trying to accomplish.
Then it will output into http://www.immortalsix.com/alumni_2.php
Thanks!
Inserting info from FORM into database.
Moderator: General Moderators
-
immortalsix
- Forum Newbie
- Posts: 2
- Joined: Tue Jun 10, 2003 11:01 am
Let's say you have/want two fields, email and name, your form will look something likeanother.script.php will receive the two (named) parameters if they have been submitted, in recent versions of php they will be stored in $_POST['name'] and $_POST['email'] as strings.
A basic insert script might look like
For more specific answer ask more specific questions 
Code: Select all
<form method="POST" action="another.script.php">
<input type="text" name="name" /><br/>
<input type="text" name="email" /><br/>
<input type="submit" />
</form>A basic insert script might look like
Code: Select all
<?php
/** <- checking values -> **/
/** <- checking values -> **/
$name = mysql_escape_string($_POST['name']);
$email = mysql_escape_string($_POST['email']);
$query = "INSERT INTO myTable (name, email) VALUES('$name', '$email')";
$mysql_query($query, $TheMysqlConnectionId);
?>