|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
mysql php from to mail
I have created a php form to add data to mysql
I would like that the same time the user is updating his data to recieve a mail with his data I am absolute begginer in php and mysql so I do not know the code to do it Could you help me I am sending you as well my form: <?php require_once('Connections/intracoma.php'); ?> <?php mysql_select_db($database_intracoma, $intracoma); $query_Recordset1 = "SELECT * FROM intracom"; $Recordset1 = mysql_query($query_Recordset1, $intracoma) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); mysql_select_db($database_intracoma, $intracoma); $query_Recordset2 = "SELECT activity.act_code, activity.act_descr, `object`.obj_code, `object`.obj_descr FROM activity, `object` ORDER BY `object`.obj_code"; $Recordset2 = mysql_query($query_Recordset2, $intracoma) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style1 {font-size: 12px} .style2 {font-size: 18px} .style3 { font-size: 18px; font-weight: bold; } .style4 {font-family: Arial, Helvetica, sans-serif} --> </style> </head> <body> <form name="form1" id="form1" method="post" action=""> <label></label> </form> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p> <span class="style1"> <span class="style2"> <label><strong>name</strong></label> </span> </span> </p> <p> <input name="name" type="text" id="name" value="<?php echo $row_Recordset1['name']; ?>" /> </p> <table width="261" border="0"> <tr> <th scope="col"><div align="left">Activity</div></th> <th scope="col">Activity Description</th> </tr> <tr> <th width="87" scope="col"><div align="left"> <select name="c" id="c" onchange="TCN_reload(this)"> <option selected="selected">c</option> </select> </div></th> <th width="103" scope="col"><div align="left"> <select name="d" id="d" onchange="TCN_reload(this)"> <option selected="selected">d</option> </select> </div></th> </tr> <tr> <td><strong>Object</strong></td> <td><strong>Object Description</strong></td> </tr> <tr> <td><div align="left"> <p> <select name="a" id="a" onchange="TCN_reload(this)"> <option selected="selected">a</option> </select> </p> </div></td> <td><p> <select name="b" id="b" onchange="TCN_reload(this)"> <option selected="selected">b</option> </select> </p></td> </tr> </table> <p> <script language="JavaScript" type="text/javascript"> TCN_contents=new Array(); TCN_tempArray=new Array(); TCN_counter=0; function TCN_addContent(str){ TCN_contents[TCN_counter]=str; TCN_counter++; } function TCN_split(){ TCN_arrayValues = new Array(); for(i=0;i<TCN_contents.length;i++){ TCN_arrayValues[i]=TCN_contents[i].split(separator); TCN_tempArray[0]=TCN_arrayValues; } } function TCN_makeSelValueGroup(){ TCN_selValueGroup=new Array(); var args=TCN_makeSelValueGroup.arguments; for(i=0;i<args.length;i++){ TCN_selValueGroup[i]=args[i]; TCN_tempArray[i]=new Array(); } } function TCN_makeComboGroup(){ TCN_comboGroup=new Array(); var args=TCN_makeComboGroup.arguments; for(i=0;i<args.length;i++) TCN_comboGroup[i]=findObj(args[i]); } function TCN_setDefault(){ for (i=TCN_selValueGroup.length-1;i>=0;i--){ if(TCN_selValueGroup[i]!=""){ for(j=0;j<TCN_contents.length;j++){ if(TCN_arrayValues[j][(i*2)+1]==TCN_selValueGroup[i]){ for(k=i;k>=0;k--){ if(TCN_selValueGroup[k]=="") TCN_selValueGroup[k]=TCN_arrayValues[j][(k*2)+1]; } } } } } } function TCN_loadMenu(daIndex){ var selectionMade=false; daArray=TCN_tempArray[daIndex]; TCN_comboGroup[daIndex].options.length=0; for(i=0;i<daArray.length;i++){ existe=false; for(j=0;j<TCN_comboGroup[daIndex].options.length;j++){ if(daArray[i][(daIndex*2)+1]==TCN_comboGroup[daIndex].options[j].value) existe=true; } if(existe==false){ lastValue=TCN_comboGroup[daIndex].options.length; TCN_comboGroup[daIndex].options[TCN_comboGroup[daIndex].options.length]=new Option(daArray[i][daIndex*2],daArray[i][(daIndex*2)+1]); if(TCN_selValueGroup[daIndex]==TCN_comboGroup[daIndex].options[lastValue].value){ TCN_comboGroup[daIndex].options[lastValue].selected=true; selectionMade=true; } } } if(selectionMade==false) TCN_comboGroup[daIndex].options[0].selected=true; } function TCN_reload(from){ if(!from){ TCN_split(); TCN_setDefault(); TCN_loadMenu(0); TCN_reload(TCN_comboGroup[0]); }else{ for(j=0; j<TCN_comboGroup.length; j++){ if(TCN_comboGroup[j]==from) index=j+1; } if(index<TCN_comboGroup.length){ TCN_tempArray[index].length=0; for(i=0;i<TCN_comboGroup[index-1].options.length;i++){ if(TCN_comboGroup[index-1].options[i].selected==true){ for(j=0;j<TCN_tempArray[index-1].length;j++){ if(TCN_comboGroup[index-1].options[i].value==TCN_tempArray[index-1][j][(index*2)-1]) TCN_tempArray[index][TCN_tempArray[index].length]=TCN_tempArray[index-1][j]; } } } TCN_loadMenu(index); TCN_reload(TCN_comboGroup[index]); } } } function findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } TCN_makeSelValueGroup("<?php echo $row_Recordset2['obj_code']; ?>","<?php echo $row_Recordset2['obj_descr']; ?>","<?php echo $row_Recordset2['act_code']; ?>","<?php echo $row_Recordset2['act_descr']; ?>"); TCN_makeComboGroup("a","b","c","d"); var separator="+#+"; <?php do{?> TCN_addContent("<?php echo $row_Recordset2['obj_code']; ?>+#+<?php echo $row_Recordset2['obj_code']; ?>+#+<?php echo $row_Recordset2['obj_descr']; ?>+#+<?php echo $row_Recordset2['obj_descr']; ?>+#+<?php echo $row_Recordset2['act_code']; ?>+#+<?php echo $row_Recordset2['act_code']; ?>+#+<?php echo $row_Recordset2['act_descr']; ?>+#+<?php echo $row_Recordset2['act_descr']; ?>"); <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?> TCN_reload(); </script> </p> <p> <label> </label> </p> <div align="left"> <table width="286" border="0" align="left"> <tr> <th scope="col"><p><span class="style3">hours</span>a <input name="hoursa" type="text" id="hoursa" /> </p> <p> <label>hoursb <input name="hoursb" type="text" id="hoursb" value="" /> </label> </p> <p>submit <input type="submit" name="submithour" value="Submit" /> </p></th> </tr> </table> </div> <p align="left"> <label></label> </p> </p> <p align="left"> <label></label> </p> </form> <?php $dbcnx = @mysql_connect('localhost', 'root'); if (!$dbcnx) { die( '<p>Unable to connect to the ' . 'database server at this time.</p>' ); } // Select the jokes database if (! @mysql_select_db('intracoma') ) { die( '<p>Unable to locate the joke ' . 'database at this time.</p>' ); } // If a joke has been submitted, // add it to the database. if (isset($_POST['submithour'])) { $name = $_POST['name']; $a = $_POST['a']; $b = $_POST['b']; $c = $_POST['c']; $d = $_POST['d']; $hoursa = $_POST['hoursa']; $hoursb = $_POST['hoursb']; $sql = "INSERT INTO intracom SET name='$name', objecta='$a', objecta_descr='$b', activitya='$c', activitya_descr='$d', hoursa='$hoursa', hoursb='$hoursb' "; if (@mysql_query($sql)) { echo('<p>Your hour has been added.</p>'); } else { echo('<p>Error adding submitted hour: ' . mysql_error() . '</p>'); } } if ($name && $object && $activity ) { echo "thank you , <b>$name</b>. you entered your data as: <b>object $object</b>, <b>hours $hours</b>,<b>activity $activity</b><ul>"; } // If a joke has been deleted, // remove it from the database. // When clicked, this link will load this page // with the joke submission form displayed. echo('<p><a href="' . $_SERVER['PHP_SELF'] . '?addhour=1">Add hours!</a></p>'); ?> </body> </html> <?php mysql_free_result($Recordset1); mysql_free_result($Recordset2); ?> |
![]() |
| Viewing: Codewalkers Forums > General > Barter Zone > mysql php from to mail |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|