username01
Members-
Posts
18 -
Joined
-
Last visited
Everything posted by username01
-
How do I put checkbox data in to database and take it from it?
username01 replied to username01's topic in PHP Coding Help
I need to write data from checked checkboxes into a database table for specific user, which is currently logged in. And after that, when the user enters the same page next time, look up the database and make the checkboxes he checked appear as checked. My current code contains not much for the checkboxes, as I have no idea how to do it: if($session->logged_in){ echo "<div align='center' id='wrap'><form action='process.php' method='post'><fieldset>"; echo "<legend>Choices</legend>"; echo "<p><input class='input' type='checkbox' title='Select anything you want' name='one' id='one' value='a'><label for='one'> Selection #1</label></p>"; // Contains ~10 of these, of course different names. echo "<input type='hidden' name='subprivilegies' value='1'/><br>"; echo "<input type='submit' value='Submit'/>"; echo "</fieldset></form></div>"; It's basically only html code for the checkboxes... -
How do I put checkbox data in to database and take it from it?
username01 replied to username01's topic in PHP Coding Help
That's for saving the checkboxes if the user goes somewhere out of the site, not to insert them into the database. I'm a newbie and not able to make a SQL code from that code yet, I need something more specific. Thanks. -
Hi. I want to put data from these checkboxes (example): Jan (value = jan) Chris (value = chris) Tom (value = 50) Jon (unchecked) Put janchris50 to the database after finding correct row with user ID, which is user_id for this example. Then, the user goes to another page and he should see this: Jan (checked) Chris (checked) Tom (checked) Jon (unchecked) In other words - page should get the information from the database and check the checkboxes that appears to be checked in the database. By the way, it should rewrite the row each time, as the user can modify it. Thanks.
-
Print specified text, if the SQL table's column's value is 0.
username01 replied to username01's topic in PHP Coding Help
Where should I put that error_reporting() and E_ALL? -
Print specified text, if the SQL table's column's value is 0.
username01 replied to username01's topic in PHP Coding Help
How can I turn that... error reporting on? -
Print specified text, if the SQL table's column's value is 0.
username01 replied to username01's topic in PHP Coding Help
It doesn't load the page at all. It's a blank page either way, so I can't tell you that. :/ -
Print specified text, if the SQL table's column's value is 0.
username01 replied to username01's topic in PHP Coding Help
Thanks, but it didn't worked still: while($row = mysql_fetch_row($query)) { if $row[3] == '0' {$row[3] = $value_text} echo "<tr>"; echo '<td>' . $row[0] . '</td>'; echo '<td>' . $row[1] . '</td>'; echo '<td>' . $row[2] . '</td>'; echo '<td>' . $row[3] . '</td>'; echo '<td>' . $row[4] . '</td>'; echo "</tr>\n"; } -
Print specified text, if the SQL table's column's value is 0.
username01 replied to username01's topic in PHP Coding Help
while($row = mysql_fetch_row($query)) { if $row == '0' {$row = $text_specified} echo "<tr>"; echo '<td>' . $row[0] . '</td>'; echo '<td>' . $row[1] . '</td>'; echo '<td>' . $row[2] . '</td>'; echo '<td>' . $row[3] . '</td>'; echo '<td>' . $row[4] . '</td>'; echo "</tr>\n"; } My equation syntax is correct, but code is wrong. -
while($row = mysql_fetch_row($query)) { echo "<tr>"; echo '<td>' . $row[0] . '</td>'; echo '<td>' . $row[1] . '</td>'; echo '<td>' . $row[2] . '</td>'; echo '<td>' . $row[3] . '</td>'; echo '<td>' . $row[4] . '</td>'; echo "</tr>\n"; } Currently I have this code. I would like to make it print certain text, let's say... 'car', if the value of table's column 'automobiles' is equal to 0. Otherwise - print the real value. I've tried if statement and $one = $two... But that apparently didn't worked. Thanks.
-
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
Hm, there won't be many users. I will be able to manually clean the database occasionally. There may be... Few users a month. It's a small community. -
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
No, I don't. I have a control, what to send to the site... Hmm. I could ask to do it another way, but then it would a little different. I could send some data to the 'unrelated' site, and send the data from the checkboxes to the database. Then, when the site will send the user to my chosen site... It could be, that it would do some different thing. Hm. Maybe, if someone could say, that he/she could do it, could send me a PM, and I could give the details, why and what exactly would be the use of it. Or, maybe I could PM you, Pikachu, and ask for advice, what would be the reliable way to do it? I don't want to post the exact use of this system I thought of in public. -
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
The unrelated site sends him back to my site, when he clicks a button. -
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
So no one will help with that? -
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
It is on a different server. -
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
Hmmm, have I explained it bad again? :/ -
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
Thanks for your reply. I will try to explain it more clearly. There is index.php with 5 checkboxes and a username field. User checks any number of those checkboxes, writes his name and clicks "next" button. After he clicks "next", the data, which is different, from which checkboxes were checked, is transferred to database1. For each checkbox, there is a letter. For example - for first - a, second - b, third - z, fourth - d, fifth - l. His username too. Also, if possible, the date and his IP address (at least the date). So he is on page1.php now... He do something on this page (unrelated to this system), in the end he is transferred to page2.php. So he is at page2.php now. The page2.php collects the values from the database1, and automatically checks checkboxes, so they look like at index.php. Also, it prints his IP address and name. Every value can be still changed. There is a "next" button. When the button is clicked, the values from these checkboxes, then are transferred to database2 and insert in 3 columns - name, ip and letters(checkboxes). I hope, that I made this explanation clearer. -
3 pages linking with a two database tables.
username01 replied to username01's topic in PHP Coding Help
No one knows? :/ -
Hi everyone. I would like to do this: In page1.php, I need to make a few checkboxes, which when the user clicks "next" button, transfers the data (which checkboxes were clicked) to a database table. Then, when the user clicks a button "next", he is moved to another page, page2.php, from which he is automatically transferred to page3.php. At page3.php those values are gathered from the database, and the user has to click "next" button again, then those values are written into another table, in the same or another database. How can I do this? I've not much knowledge with neither SQL, neither PHP. I hope you will help me make this work, I'm making a little system for my HTML website. Thanks, if you do!