getting the value

i want to get the value as input.

e.g <input type=“text” name=“ttt” value="<?php echo $row['smth']?>

i want to get the value inside php tags and insert in db.


<? $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!isset($_POST['ttt'])) {?> <? } else { $pnme=$_POST['ttt']; $sql="insert into nameofdbtable set nameofdbcolum='$pnme'"; $result = mysql_query($sql); }


try that

thank u for your help but i wasn`t so accurate to what i want.


ID : name : surname : birthday (dd/mm/vvvv): sex : [/code]

i want that all the values inside the php tags insert in db. i get error (object not found). these datas are retrieved from a db1 and i want to save in another db2.

can i ask why you want to receive data from db1 when those are text feilds

i got a school project and this is a part of it. that mean that user(in my case student) should see some of his/her datas after processing the next step

OK you only gave use your code for the form can you give us a little more do you not have that code

this is the form where i should get the data and save in db2. the php code doesnt work cause of that i didnt give to you(are more example than a concrete code). the connection with db2 its ok but i dont know how to get datas and insert in db2. this is the connection:
mysql_connect(“localhost”,“root”,"") or die("");
mysql_select_db(“general_db”) ;
$con= $_SESSION[‘ID’];
$qu=“select ID, name, surname, birthday, sex from student where ID= ‘$con’”;
$q= mysql_query($qu) or die("");
$row = mysql_fetch_array($q);
and below this is the html form (the code i sent before) with a submit button

is this kinda what you needed

ok i gotta fix that

ok should work way you want it now :frowning: sorry

i will explain how i did it when you get on here

first of all,
Happy New Year and all the best!!

yes, that is the form i want
all the fields(name, surname, sex) should have a value(these values i get from db1) like the ID. when i click submit, all these displayed datas (the value of ID, name, surname) should save in the db2.

does it need to be 2 databases because i made so you can use 1 database and it updates as yuo change things

yes it needs 2 dbs. the db1 has the informations i need. what do you think about the session (keeping the all information in session after select from db1)?

right but how are you getting the info to first db table is it hard coded or you have to get the info to it

and does it use 1 column in the second db table or does it make another one each time you click submit

no its not a hard coded.its just a selec from db1. below is the db1 where i have to get the information.i just read the information without any permission to change nothing, display in the form and after submit all information save in db2 (with the same structure of db1)

k so the database is already there meaning it is hard coded info
and all you want is to get that info from that in a select form meaning dropdown form then on submit input into db2

Sponsor our Newsletter | Privacy Policy | Terms of Service