Posting to two different places from one forum - HELP ME PLZ?

Agenator

Member
Messages
341
Reaction score
0
Points
16
I'm working on a project and want to update two things with one button. First I want the user to fill out a forum containing their email address phone number address etc. I want to post all of this information to a table called information where it will be used for a snail mail address. I then want to post the email address alone to another table that is included in the mailing list program I have for emails. Anyway I need to know how to do this. Thanks
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
Just submit the form (not forum) to a php page that does both things.
 

Agenator

Member
Messages
341
Reaction score
0
Points
16
I'm not entierly sure how I would go about doing this, so could you set up some example code for me to look at? thanks
 

Mohron

New Member
Messages
49
Reaction score
0
Points
0
Something like this?

register.php/.html
HTML:
<form action="adduser.php" method="post" name="newUserRegistration" id="newUserRegistration">
<input name="name" type="text" />
<input name="email" type="text" />
<input name="phone" type="text" />
<input name="address" type="text" />
<input name="submit" type="submit" id="submit" value="Submit" />
</form>
adduser.php
Code:
require(dbcon.php); //script with DB connection details
$name=strip_tags(stripslashes($_POST['name']));
$email=strip_tags(stripslashes($_POST['email']));
$phone=strip_tags(stripslashes($_POST['phone']));
$address=strip_tags(stripslashes($_POST['address']));
$sql="INSERT INTO members (name, email, phone, address) VALUES ('$name','$email','$phone','$address')";
$sql=mysql_real_escape_string($sql);
$userresult=mysql_query($sql);
if (!$userresult){
	die('Could not create user: '.mysql_error());
	}
$sql="INSERT INTO email (email) VALUES ('$email')";
$sql=mysql_real_escape_string($sql);
$emailresult=mysql_query($sql);
if (!$emailresult){
	die('Could not add email: '.mysql_error());
	}
echo 'Success';
 
Top