tuxbuddy Posted April 11, 2008 Share Posted April 11, 2008 Hello Guys, I have written a code for my registration page which after being submitted will move data into the database.I have few registration inputs like ID, FirstNAme,SecondName,Title,Group etc.Now corresponding to that,I have database entry like id,firstname,secondname,title but GROUP is all I am interested to talk about. Actually,I have designed a page to accept project as NAME through dropdown list retrieving values from mysql database.....but the database is not having an entry as NAME..rather it has entry called group_id. Now What I want is After user inputs the Groupname,corresponding to that I have a table called groups..so it should retrieve group_id from that and then it should actually insert into the required table. In short, 1. User input the data into registration page. 2. He will select groupname from dropdown list 3. We wont put it directly into database 4. But retrieve group_id from groupname(----<<< Transition state) 5.And then addu group_id into "users" table(the ultimate database to enter) Heres my codes: File : register.php ------------------------ <?php $con=mysql_connect("localhost","root","mysql123"); mysql_select_db("helpcore",$con); $sql=mysql_query("select name from groups"); ?> <html><title>User Registration Page</title> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <p> <body bgcolor="#d0d0d0"> <img src="helpcore.jpg" align="center"> </p> <form action="insert.php" method="post"> <!--<INPUT TYPE="HIDDEN" NAME="action" VALUE="register">--> <DIV ALIGN="CENTER"><CENTER> <TABLE BORDER="1" WIDTH="90%"> <h1> User Registration Form</h1> <TR> <TH WIDTH="30%" NOWRAP>Title</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="title"VALUE="<?php echo $title ?>" SIZE="8" MAXLENGTH="8"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Letters</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="first_letters" VALUE="<?php echo $first_letters ?>" SIZE="20"></TD> </TR> <TR> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="firstname" VALUE="<?php echo $firstname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Middle Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="middlename" VALUE="<?php echo $middlename ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Last Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="lastname" VALUE="<?php echo $lastname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Surname</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="surname" VALUE="<?php echo $surname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Email</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="email" VALUE="<?php echo $email ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Telephone Nr.</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="telnr" VALUE="<?php echo $telnr ?>" SIZE="20"></TD> <TR> <TR> <TH WIDTH="30%" NOWRAP>login Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="loginname" VALUE="<?php echo $loginname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Password</TH> <TD WIDTH="70%"><INPUT TYPE="PASSWORD" NAME="password" SIZE="15"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>[color=red]GROUP[/color]</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="group_id"VALUE="<?php echo $group_id ?>" SIZE="20"></TD></TR> <TR> <TH WIDTH="30%" NOWRAP>[color=red]GROUP[/color]</TH> <TD WIDTH="70%"><select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="" ><? echo $row["name"]; ?></options><? } ?></select></TD></TR> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html> After user inut the values,a temporary database is updated: File:insert.php <?php $firstname=$_POST['firstname']; $surname=$_POST['surname']; $email=$_POST['email']; $password=$_POST['password']; $loginname=$_POST['loginname']; $telnr=$_POST['telnr']; $rooms_id=$_POST['rooms_id']; $organisation_id=$_POST['organisation_id']; $middlename=$_POST['middlename']; [color=red]$group_id=$_POST['group_id'];[/color] $department_id=$_POST['department_id']; $loc_telnr=$_POST['loc_telnr']; $title=$_POST['title']; $first_letters=$_POST['first_letters']; $con = mysql_connect("localhost","root","mysql123"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("helpcore", $con); $sql="INSERT INTO member (firstname, surname, email, password, is_admin, loginname, personeelsnummer, allowed_to_log_in, telnr, rooms_id, may_log_in, ip, session_key, last_contact, initial_contact, last_visited_page, organisation_id, middlename, [color=red]group_id[/color], department_id, building_id, loc_telnr, global_view, sla_level_id, title, first_letters, session_use_alerts,notes) VALUES ('$firstname','$surname','$email','$password',0,'$loginname',NULL,NULL,'$telnr','$rooms_id',0,'127.0.0.1',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00',NULL,NULL,'$middlename',NULL,NULL,NULL,'$loc_telnr',0,0,'$title','$first_letters',0,'GET')"; $result=mysql_query($sql); if($result){ #if (!mysql_query($sql,$con)) # { # die('Error: ' . mysql_error()); # } #include("banner.gif"); #include("mailing.php"); #echo "Thanks for the Registration.Your Record has been sent for Approval.Kindly wait for the PETP Approval Mail"; $to="ajeet.singh.raina@logicacmg.com"; // Your subject $subject="Activation Request Mail"; // From $header="This mail is automatically generated from PETP-INSTALL NEW TICKET TRACKIING TOOl "; // Your message $message="A New User has registered for an account\n"; $message="This mail is regarding a New User Account Activation \r\n"; $message.="Click on this link to activate his account \r\n"; $message.="http://10.14.2.36/petp/activation.php?passkey=$loginname"; // send email $sentmail = mail($to,$subject,$header,$message); //mail(ajeet.singh.raina@logica.com,Test,Test,test); //echo " Kindly Check your mail for final arrpoval status"; } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Thanks for the Registration\n."; echo "You will soon receive an activation mail from INSTALL TEAM."; } else { echo "Cannot send Confirmation link to your e-mail address"; } mysql_close($con) ?> How can I insert not the GROUPNAME but groupid to that? Thanks in advance., Pls Help Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 i think ur asking that ...if user selects name from drop down groupid of corresponding groupname should be displayed in textbox... right Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 11, 2008 Author Share Posted April 11, 2008 Not exactly....I want him to select GROUPNAME during the registration page but when the data gets inserted into the database it shoud be group_id not groupname... That means before inserting the data during insert.php,we should retrieve group_id from groupname(from tabel named groups)... Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 then you should pass hidden values ... write query... near submit button write .. Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 sorry pal... it should be done through javascript... i user selects name userid for corresponding name should be got from database and passed to another page write... Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 11, 2008 Author Share Posted April 11, 2008 Can you plz help me with this?I am not able to understand how yu gonna implement that. You can see the codes above.Can you help me out writing this code? Pls.... Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 hey.. sorry no need of javascript and other things and all.... just type .. <option value="<? echo $row["id"];?>" ><? echo $row["name"]; ?> </options> inside option values..u can retrieve id instead of names on other page... Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 in your register .php page... type this... <?php $con=mysql_connect("localhost","root","mysql123"); mysql_select_db("helpcore",$con); $sql=mysql_query("select * from groups"); ?> Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 11, 2008 Author Share Posted April 11, 2008 I will try implementing.But you dint reply how I gonna take group_id value. I am seeing two GROUP tables which I have named "PROJECT" Here's the code: <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="group_id"VALUE="<?php echo $group_id ?>" SIZE="20"></TD></TR> <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"><select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="<? echo $row["id"];?>" ><? echo $row["name"]; ?> </options><? } ?></select></TD></TR> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html> if I delete the first text box then where it gonna select group_id value. What about the second text value????It is not taking group_id as we dint mention. Pls help Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 it should work perfect..... <?php $con=mysql_connect("localhost","root","mysql123"); mysql_select_db("helpcore",$con); $sql=mysql_query("select * from groups"); ?> <html><title>User Registration Page</title> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <p> <body bgcolor="#d0d0d0"> <img src="helpcore.jpg" align="center"> </p> <form action="insert.php" method="post"> <!--<INPUT TYPE="HIDDEN" NAME="action" VALUE="register">--> <DIV ALIGN="CENTER"><CENTER> <TABLE BORDER="1" WIDTH="90%"> <h1> User Registration Form</h1> <TR> <TH WIDTH="30%" NOWRAP>Title</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="title"VALUE="<?php echo $title ?>" SIZE="8" MAXLENGTH="8"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Letters</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="first_letters" VALUE="<?php echo $first_letters ?>" SIZE="20"></TD> </TR> <TR> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="firstname" VALUE="<?php echo $firstname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Middle Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="middlename" VALUE="<?php echo $middlename ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Last Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="lastname" VALUE="<?php echo $lastname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Surname</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="surname" VALUE="<?php echo $surname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Email</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="email" VALUE="<?php echo $email ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Telephone Nr.</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="telnr" VALUE="<?php echo $telnr ?>" SIZE="20"></TD> <TR> <TR> <TH WIDTH="30%" NOWRAP>login Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="loginname" VALUE="<?php echo $loginname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Password</TH> <TD WIDTH="70%"><INPUT TYPE="PASSWORD" NAME="password" SIZE="15"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>[color=red]GROUP[/color]</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="group_id"VALUE="<?php echo $group_id ?>" SIZE="20"></TD></TR> <TR> <TH WIDTH="30%" NOWRAP>[color=red]GROUP[/color]</TH> <TD WIDTH="70%"><select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="<? echo $row["group_id"];?>"><? echo $row["name"]; ?></options><? } ?></select></TD></TR> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html> Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 & in register.php page... <?php $group_id=$_POST["name"]; echo $group_id; $firstname=$_POST['firstname']; $surname=$_POST['surname']; $email=$_POST['email']; $password=$_POST['password']; $loginname=$_POST['loginname']; $telnr=$_POST['telnr']; $rooms_id=$_POST['rooms_id']; $organisation_id=$_POST['organisation_id']; $middlename=$_POST['middlename']; //[color=red]$group_id=$_POST['group_id'];[/color] $department_id=$_POST['department_id']; $loc_telnr=$_POST['loc_telnr']; $title=$_POST['title']; $first_letters=$_POST['first_letters']; Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 11, 2008 Author Share Posted April 11, 2008 Thanks Man...You have helped me a lot...I will check that too... Can you ask you for a decent help..? If really you think you can be helpful for me for my project. I have discussed it too in this forum but I dont see any reponse till now. Lemme discuss this with you too. I have a new PHP Developer recently joined a company.this is a time to impress my manager and I want a helpful hands for that..I hope you gonna help me with my project work ahead. Have you tried a ticket tracking tool called "HelpCOre" It is Open Source and completely in PHP. Now its recent version is 1.7 which is commercial but before that ie. 1.6 it was free.I downloaded the tool. But there are lots of thing my manager wants me to add up. Like timing,SLA stuffs etc.Now I am working for Registration and email verification stuff.But I need your help in TIming as it is totally confusing. Its difficult to understand the tool created by other people..but since Its urgent to be implemented I need to add up few features. If you can , then I can help you installing the tool..all you need is see on this tool and add up two major things--timing and SLA suffs etc. Will you help me wiht this??/ Quote Link to comment Share on other sites More sharing options...
zenag Posted April 11, 2008 Share Posted April 11, 2008 of course sure ..i will try my best.... im at present in a concern .. presently im free .....anytime projects wl be alloted to me...so i wl do it on late night in indian timings. .....at present time is 6.00pm .. i wl be back on monday... we are on tour to near by location ....so i wl catch u on monday at 10.00am indian timings... feel free to clear doubts.... Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 14, 2008 Author Share Posted April 14, 2008 Can you have your email ID?Its possible to send yu project details through this post.Anyway I will send you a few details and we can post here the process we adopted to carry on further issues Waiting for yur reply. Quote Link to comment Share on other sites More sharing options...
zenag Posted April 15, 2008 Share Posted April 15, 2008 jaiganez@gmail.com is my mail id Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 15, 2008 Author Share Posted April 15, 2008 I have sent you the project details with downlaod and install instruction. Do let me know if you receive thems so that I can explain you the tool more clearly. Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 15, 2008 Author Share Posted April 15, 2008 Did yu install the Tool? Quote Link to comment Share on other sites More sharing options...
zenag Posted April 15, 2008 Share Posted April 15, 2008 yes i ve installed it... Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 28, 2008 Author Share Posted April 28, 2008 Hello Ganesh, I am back again.I was on vacation for 1 week and now Shall we continue with the stuff,if yu r free. Pls Reply Quote Link to comment Share on other sites More sharing options...
zenag Posted April 28, 2008 Share Posted April 28, 2008 yeah...im free .... Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 28, 2008 Author Share Posted April 28, 2008 Good !! Lets talk about the issue ahead.I think you might have copied the folder to your PC.Lemme tel you the issue.In that folder called HelpCORE I have sent yu thru mail,there is one file called time.php.Its path is : /var/www/html/peisd/lib/adodb/tests/time.php /var/www/html/HelpCORE/coreapm/includes/time.php /var/www/html/HelpCORE.bak/coreapm/includes/time.php KIndly go through them if tool is near you or I will send you the same again. Should I The timing issue is : The tool follows 24*7 customer suport kindda stuff but our compant timing is from 10 to 6. If it is 24/7 it will affect SLAs. Quote Link to comment Share on other sites More sharing options...
zenag Posted April 28, 2008 Share Posted April 28, 2008 im not having .... /var/www/html/peisd/lib/adodb/tests/time.php /var/www/html/HelpCORE.bak/coreapm/includes/time.php... but..m hvng this one.... /var/www/html/HelpCORE/coreapm/includes/time.php Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 28, 2008 Author Share Posted April 28, 2008 No issue.continue with that.I just guess tweakign code with this may help us to solve the issue.Can yu pliz go thru this code.Any hint in this code for changinf the time ... Quote Link to comment Share on other sites More sharing options...
zenag Posted April 28, 2008 Share Posted April 28, 2008 k Quote Link to comment Share on other sites More sharing options...
tuxbuddy Posted April 28, 2008 Author Share Posted April 28, 2008 Did you check? Any Hint? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.