This is probably as basic as you can get for creating a dynamic site but as you can see I am a beginner.
IT DOESN'T WORK but I'm sure you will be able to see why. I have tried various iterations but it returns a string that says it cant find welcome.php.*
I created a form on a page called register.php. From what I can tell you are supposed to pass the information to a page that can process the database insertion.
<form action=”welcome.php” method=”post”>
<label for="first_name">First Name:</label><br>
<input type="text" id="first_name" name="first_name"><br>
<label for="last_name">Last Name:</label><br>
<input type="text" id="last_name" name="last_name"><br>
<input type="checkbox" id="agent" name="agent" value="1">
<label for="agent"> I am an Agent</label><br>
<label for="address1">Address 1:</label><br>
<input type="text" id="address1" name="address1"><br>
<label for="address2">Address 2:</label><br>
<input type="text" id="address2" name="address2"><br>
<label for="city">City:</label><br>
<input type="text" id="city" name="city"><br>
<label for="state">State:</label><br>
<input type="text" id="state" name="state"><br>
<label for="zip">Zip Code:</label><br>
<input type="text" id="zip" name="zip"><br>
<label for="email">EMail Address:</label><br>
<input type="text" id="email" name="email"><br>
<br>
<input type="submit" value="Submit">
</form>
So I created a welcome.php page that only has this info on it. (My database has all these fields and is called Temp1 and table1 is where the data resides.
<?php
$connect = mysql_connect(“localhost”, “root”, “MY_PASSWORD”); if (!connect) { die('Connection Failed: ' . mysql_error()); { mysql_select_db(“temp1”, $connect);
$sql = “INSERT INTO table1 (first_name, last_name, address1, address2, city, state, zip, agent, email) VALUES ('$_POST[first_name]', '$_POST[last_name]')” '$_POST[address1]', '$_POST[address2]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[agent]', '$_POST[email]', ; if (!mysql_query($user_info, $connect)) { die('Error: ' . mysql_error()); }
echo “Your information was added to the database.”;
mysql_close($connect); ?>
?>