|
*dhtml
|
Now you have a MySQL table with only one field - formData database - >table structure - formData [LongText]
form 1 username password
form 2 firstname lastname email
form3 contact address message text
So i have drawn out like 3 different forms. Now how will you write a single php script that can submit any of the form data into that table and hold all the values for future purposes. Dont bother yourself with retrieval (that is slightly advanced)
Lemme attempt to clarify so in form 1, you say action="send.php" and you repeat the same in form2 and form3
So that no matter the number of fields, the script can submit them into a single row in the 1 X 1 table! If i am not making sense, please ask o!
|
|
|
|
|
|
quadrillio (m)
|
it's seem No beginner in d house can dare an attempt, maybe average coder, should be added.
b4 pros go begin take annoyance answer d question, LOL.
patiently waiting.
SAFE
|
|
|
|
|
|
biggjoe (m)
|
This question has been open since yesterday and yet no one seems to be willing to respond. Reasons for that could be that: 1. people are afraid of being termed a 'beginner' if they answer it. 2.the question might not be completely clear 3.people dont just know the answer  In my own case, I will attempt to answer it, beginner or no beginner BUT the question is not completely clear to me . @dhtml, 1. are you asking us to write a script that submits all the form fields into one DB field? 2. if so, do you expect the data submitted to be separated by anything (space or comma)?
|
|
|
|
|
|
yawa-ti-de (f)
|
biggjoe: I think if you did a poll, most people would probably go for #2  I have been scratching my head since the quiz went up and haven't asked for clarification cos I don't even know what to ask clarification for 
|
|
|
|
|
|
nitation (m)
|
@ yawatide
I think that should be it, but you never can tell with DHTML. Maybe we must use the framework to achieve this. Bros come and answer us ooo! This question is kicking my butt
- nitation
|
|
|
|
|
|
*dhtml
|
has nothing to do with my framework really. . .they key is serializing data in php http://www.php.net/serializeYou can just serialize the entire post array into a single variable. . . .in short, the submission script will be something like this: submit.php <?php $val=mysql_real_escape_string(serialize($_POST)); mysql_query("insert into jos_register(raw) values('$val',curdate(),curtime()) ") or die(mysql_error()); ?> That is a sample submission script copied directly from a past project, just remove the curdate and time to get the direct solution to the quiz. Serializing is the means by which sessions are stored whether in files or database. No matter the number of session data you store, they will be stored using serialize and decoded during serialization. Serialization is a very old programming technique you find in all self-respecting programming languages from c++,java. . . .
|
|
|
|
|
|
biggjoe (m)
|
has nothing to do with my framework really. . .they key is serializing data in php http://www.php.net/serializeYou can just serialize the entire post array into a single variable. . . .in short, the submission script will be something like this: submit.phpThat is a sample submission script copied directly from a past project, just remove the curdate and time to get the direct solution to the quiz. Serializing is the means by which sessions are stored whether in files or database. No matter the number of session data you store, they will be stored using serialize and decoded during serialization. Serialization is a very old programming technique you find in all self-respecting programming languages from c++,java. . . . Now at least we know what you want us to do. The way I would have done it is by concatenating all the POST variables into a single variable. That was why I asked do u want the fields separated by anything (comma or space.) Before you said it, I didnt even know about serialization. Below is how I intended to do it. To insert username, password and firstname into table - 'dtable' with field 'formData' <?php // I'll declare all the variables first (not 4getting to escape all escapables  ). $user = $_POST['username']; $pass= $_POST['password']; $fname = $_POST['firstname']; // then combine them all. Of course, anything (space or comma) can be in between if required. $var =$user.$pass.$fname; // then I will insert $var into dtable mysql_query("INSERT INTO dtable (formData) VALUES('$var')") or die(mysql_error()); ?>
|
|
|
|
|
|
lojik (m)
|
@dhtml aint heard of serialize b4. Seriously speaking, if u say this is for beginners only, then i guess i shd be called an aspiring beginner.  . How u dey bros. I still dey boot o. i go holla u wen i don login.
|
|
|
|
|
|
*dhtml
|
ok, my mistake, but i was thinking serialization is beginners stuff. O well, anyway, it is quite trivial anyway. Just like we have json_encode/json_decode, escape/unescape,urlencode/urldecode. . . .so we have serialize/unserialize Lojik, dont worry, my framework is ready to do some work, i have already used it on 3 websites already and they are working fine. but i am still doing some evaluation, but it works as it should.
|
|
|
|
|
|