Location: PHPKode > projects > NetVis Module > netvis/survey_add.php
<?php
// add a person to social network when selected from survey_modify.php

	include("config.php");
	include($baseDir . "common/_func.php");

	//if user is not logged in, redirect to homepage
		if(!isset($uID)){header("Location: http://www.netvis.org");exit;}

	//if user is logged in as demo, redirect to homepage
		demoRedirect($username);

	$current=1;
	if(!isset($process)){
		$process=FALSE;
	}
	if($process==7){

		// define variables
		$array_variables = array("name","age","sex","known","distance","ftf","pho","ema","im");
	
		for($i=0; $i<count($array_variables); $i++){
			$array_variable="$array_variables[$i]".$current;
				if(!isset(${$array_variable})){
					${$array_variable}=FALSE;
				}
		}
			$sql="SELECT * FROM networks WHERE uID=$uID AND netname=\"$net\"";
			$result=mysql_query($sql) or die(sqlError($sql));
			$row=mysql_fetch_array($result);
			$name_edit=$row['names'].${"name".$current}.",";
			$sql="UPDATE networks SET netnum=".($row['netnum']).", names=\"$name_edit\" WHERE uID=$uID AND netname=\"$net\"";
			mysql_query($sql) or die(sqlError($sql));
			$build_statement="INSERT INTO people SET ".
				"uID='$uID',".
				"datetime=\"".date("Y-m-d G:i:s")."\",".
				"network='$net',".
				"name='${"name".$current}',".
				"age='${"age".$current}',".
				"sex='${"sex".$current}',".
				"known='${"known".$current}',".
				"distance='${"distance".$current}',".
				"ftf='${"ftf".$current}',".
				"pho='${"pho".$current}',".
				"ema='${"ema".$current}',".
				"im='${"im".$current}'";
			mysql_query($build_statement) or die($build_statement);
			header("Location:survey_modify.php");
	}else{
		include($baseDir . "common/_javascript.php");
		include($baseDir . "common/_header.php");

?>

<center>
<H2>Please describe this relationship in your
 <?php echo $net ?> social network</H2>
</center>
<center>
 <table width=700 border=0 cellspacing=0 cellpadding=1>
<form method=post action="<?php echo $PHP_SELF?>">
 <table width=65%>
<tr>
 <td bgcolor=#006699 width='42%'>
	<font color=#FFFFFF>Name (First Name and Last Initial)
	 </font>
 </td>
 <td bgcolor=#eeeeee width='47%'>
	<input maxlength=64 size=32 name="name<?php echo $current ?>" value="<?=$add_name?>">
 </td>
</tr>
<tr>
 <td bgcolor=#006699 colspan=2> <font color=#FFFFFF>Age / Sex</font></td>
 <td bgcolor=#CCCCCC width='47%'>
	<input maxlength=4 size=4 name="age<?php echo $current ?>">
	years /
	<input type=radio name="sex<?php echo $current ?>" value=1>
	Male
	<input type=radio name="sex<?php echo $current ?>" value=2>
	Female </td>
</tr>
<tr>
 <td bgcolor=#006699 colspan=2><font color=#FFFFFF>How long have you
	known him/her?</font></td>
 <td bgcolor=#eeeeee width='47%'>
	<input type=radio name="known<?php echo $current ?>" value=1>
	< 1 month<br>
	<input type=radio name="known<?php echo $current ?>" value=2>
	< 3 months<br>
	<input type=radio name="known<?php echo $current ?>" value=3>
	< 6 months<br>
	<input type=radio name="known<?php echo $current ?>" value=4>
	< 1 year<br>
	<input type=radio name="known<?php echo $current ?>" value=5>
	< 2 years<br>
	<input type=radio name="known<?php echo $current ?>" value=6>
	< 3 years<br>
	<input type=radio name="known<?php echo $current ?>" value=7>
	3+ years</td>
</tr>
<tr>
 <td bgcolor=#006699 colspan=2><font color=#FFFFFF>How close to you does
	he/she live?</font></td>
 <td bgcolor=#CCCCCC width='47%'>
	<input type=radio name="distance<?php echo $current ?>" value=1>
	Same building<br>
	<input type=radio name="distance<?php echo $current ?>" value=2>
	Same neighborhood<br>
	<input type=radio name="distance<?php echo $current ?>" value=3>
	Same town<br>
	<input type=radio name="distance<?php echo $current ?>" value=4>
	Same state<br>
	<input type=radio name="distance<?php echo $current ?>" value=5>
	Same country<br>
	<input type=radio name="distance<?php echo $current ?>" value=6>
	Further away</td>
</tr>
<tr valign=center>
 <td valign=center colspan=3>
	<table border="0" cellpadding="2">
	 <tr valign=center bgcolor=#006699>
	<td valign=center colspan="8" align=center>
	 <div align='left'><font color=#FFFFFF>How frequently do you communicate
		with this person using these modes of communication?</font></div>
	</td>
	 </tr>
	 <tr valign=center bgcolor=#006699>
	<td valign=center width=30% align=center></td>
	<td valign=center width=10% align=center><font color=#FFFFFF>Never</font></td>
	<td valign=center width=10% align=center><font color=#FFFFFF>Every
	 few months</font></td>
	<td valign=center width=10% align=center><font color=#FFFFFF>Every
	 few weeks</font></td>
	<td valign=center width=10% align=center><font color=#FFFFFF>1-2
	 days a week</font></td>
	<td valign=center width=10% align=center><font color=#FFFFFF>3-5
	 days a week</font></td>
	<td valign=center width=10% align=center><font color=#FFFFFF>About
	 once a day</font></td>
	<td valign=center width=10% align=center><font color=#FFFFFF>Several
	 times a day</font></td>
	 </tr>
	 <tr valign=center bgcolor=#CCCCCC>
	<td valign=center > a. In person</td>
	<td valign=center align=center>
	 <input type=radio name="ftf<?php echo $current?>" value=1>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ftf<?php echo $current?>" value=2>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ftf<?php echo $current?>" value=3>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ftf<?php echo $current?>" value=4>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ftf<?php echo $current?>" value=5>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ftf<?php echo $current?>" value=6>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ftf<?php echo $current?>" value=7>
	</td>
	 </tr>
	 <tr valign=center bgcolor=#CCCCCC>
	<td valign=center >b. By phone</td>
	<td valign=center align=center>
	 <input type=radio name="pho<?php echo $current?>" value=1>
	</td>
	<td valign=center align=center>
	 <input type=radio name="pho<?php echo $current?>" value=2>
	</td>
	<td valign=center align=center>
	 <input type=radio name="pho<?php echo $current?>" value=3>
	</td>
	<td valign=center align=center>
	 <input type=radio name="pho<?php echo $current?>" value=4>
	</td>
	<td valign=center align=center>
	 <input type=radio name="pho<?php echo $current?>" value=5>
	</td>
	<td valign=center align=center>
	 <input type=radio name="pho<?php echo $current?>" value=6>
	</td>
	<td valign=center align=center>
	 <input type=radio name="pho<?php echo $current?>" value=7>
	</td>
	 </tr>
	 <tr valign=center bgcolor=#CCCCCC>
	<td valign=center > c. By e-mail</td>
	<td valign=center align=center>
	 <input type=radio name="ema<?php echo $current?>" value=1>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ema<?php echo $current?>" value=2>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ema<?php echo $current?>" value=3>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ema<?php echo $current?>" value=4>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ema<?php echo $current?>" value=5>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ema<?php echo $current?>" value=6>
	</td>
	<td valign=center align=center>
	 <input type=radio name="ema<?php echo $current?>" value=7>
	</td>
	 </tr>
	 <tr valign=center bgcolor=#CCCCCC>
	<td valign=center> d. By instant messaging </td>
	<td valign=center align=center>
	 <input type=radio name="im<?php echo $current?>" value=1>
	</td>
	<td valign=center align=center>
	 <input type=radio name="im<?php echo $current?>" value=2>
	</td>
	<td valign=center align=center>
	 <input type=radio name="im<?php echo $current?>" value=3>
	</td>
	<td valign=center align=center>
	 <input type=radio name="im<?php echo $current?>" value=4>
	</td>
	<td valign=center align=center>
	 <input type=radio name="im<?php echo $current?>" value=5>
	</td>
	<td valign=center align=center>
	 <input type=radio name="im<?php echo $current?>" value=6>
	</td>
	<td valign=center align=center>
	 <input type=radio name="im<?php echo $current?>" value=7>
	</td>
	 </tr>
 </table>
 <table width=700 border=0 cellspacing=0 cellpadding=1>
	<tr>
	<td align=center>
	 <a class=smalltext onClick='document.forms[0].jsenabled.value = "T";
	 document.forms[0].submit(); return false;' href="<?php echo $PHP_SELF ?>">
	 <img alt="Submit" src="<?php echo $url . "/img/submit.gif"; ?>" border=0 width="59" height="17">
	 </a>
	</td>
 </tr>
 <input type=hidden value=F name=jsenabled>
	<input type=hidden name=process value=7>
 </form>
 </table>
 </center>

<?php
	include($baseDir . "common/_footer.php");
	}
?>
Return current item: NetVis Module