Hey,

I was wondering if someone would be able to tell me how I can let a user fill out a form and it would create a page with that information for other people to see (Sort of like a forum).

I currently have no code for this but I would be able to setup a form easily so no need to show the code for a form. I also has a users database already setup with members in it.

Thanks

Thanks but no, I didn't mean profile page and registration, I meant like a page where a user can submit a form and other users can see it (Basically like when you start a new discussion on here).

Member Avatar for LastMitch

@Yorkiebar14

I meant like a page where a user can submit a form and other users can see it (Basically like when you start a new discussion on here).

DaniWeb used to use vbulletin something like that as a platform but now uses codeigniter as platform. DaniWeb is using a text editor! Where can you find a custom text editor? Just Google it.

Yes but what code in the text editor? Lol

Lol ok thanks :P

@LastMitch, I'm confused to what you mean by "Text Editor" :P

Ok, back to the OP.. So, you want a profiling system for your users. It's surprisingly simple, I'll guide you through the concepts, and, you can code it or find tutorials out there..

So first off, you need a user system (This includes: Sign-in, sign-up etc.) and you should take full advantage of SESSIONS, as, these will come into great use later on.

To answer your profile section, you would have to use $_GET to retrive this from a database, so it will look a bit like this:

<?php

   $foo = $_GET['user_id'];

   $query = "SELECT * FROM Accounts WHERE user_id='$foo'";
   $res = mysql_query($query);
   // everything else

Then you would provide links like:

www.yoursite.com/profile.php?id=1

And this should hopefully show the first person in the database :P!

THIS method can work for forums etc. But, will act a bit differently. I built a forum a few years ago and once you have the concept, it is a lot easier, but, it's one of them things you need to sit down and draw out the logic rather than asking on forums ;)!

Member Avatar for LastMitch

@phorce

@LastMitch, I'm confused to what you mean by "Text Editor" :P

I attach am image. He wants the editor that Daniweb is using and script which member talk back and forward on the thread. I got no idea what code is that?

@LastMitch - Oh, I see :P This can be done using jQuery / Ajax! The preview etc.. And then just parse the BBcodes in as you would normally in PHP.

Ok thanks everyone, I'll try it as soon as I get home :) quick question though about the get method. How can I make it so the user can create a page, example, for profiles it just has ID then it gets the data from the database and outputs email etc, how can they store HTML in the database? Or at least give their text colours etc?

@Yorkiebar14

Right, so if we're talking about pages, then, it would just be an ID.. E.g.

www.yoursite.com/page.php?id=1 -> will get the information from the '1' ID.

how can they store HTML in the database? Or at least give their text colours etc?

You can store HTML and then output it, however, this isn't really an advised method. INSTEAD, use bbcodes / formatting codes and disable HTML completely and just parse it using PHP. Here's an example:

Input:

[b]Hello my name is Phorce[/b]

Output:
Hello my name is Phorce

You can do this for pretty much anything, it can get really technical and advanced depending on what formatting you want to do. For example [p][/p] and you could even have a positioning system, just think of it like a "grid".

An alternative route (and I have used this method before) is to implement a drag/drop for "divs" in which the user can drag the elements on the page, and when they drop the element it updates itself.

Hope this helps :)!

Okay, so if I wanted to let the user make a page using bbcodes... how would I do this?

Do I need to set up bb codes or is part of php?
And would I just make the information they enter in to a textbox be stored in a 'VARCHAR' field in a database then just output it like I would their username on the screen for example?

(I appreciate the help :) )

@Yorkiebar14 You can search on google for tutorials search "preg_replace" etc..

And no, not really, depending on how many characters you want them to enter. It depends on what you're showing.. If there's going to be quite a lot of text you can use data types like mediumtext, longtext etc.. But in theory, you would display it as you would their username.. E.g.

<?php
  // mysql connection

  $id = $_GET['id']; // validate this.

  $q = "SELECT * FROM page WHERE page_id='$id'";
  $r = mysql_query($e);
  while($row = mysql_fetch_array($r))
  {
     // 
  }

Ok thanks :) I'm just making the form now, I'll let you know how I got on after I've tested it.

I think its working but I have one problem thats stopping it. The link won't add the tableID to the end of the url.

PHP Code:

<?php

    session_start();

    //Connected Here

    $username = $_SESSION['username'];

    $query = "select * from threads3 where username = 'Admin'";

    $result = mysql_query($query, $conn) or die(mysql_error());

    $getinfo = mysql_fetch_row($result);

    $tableID = $getinfo[0];

    mysql_close($conn);
?>

Output Code:

 <?php
    while($row = mysql_fetch_array($result))
    {
     echo '&nbsp; &nbsp; &nbsp; <a href="showThread.php?threadID="'.$tableID.'>'.$row['title'];
     echo '<br/>';
    }
?>

Any help?

Nvm I got it working, just had to change:
echo '&nbsp; &nbsp; &nbsp; <a href="showThread.php?threadID="'.$tableID.'>'.$row['title'];
to
echo '&nbsp; &nbsp; &nbsp; <a href="showThread.php?threadID='.$row['tableID'].'">'.$row['title'];

Its now fully working, thank you!! :D

@Yorkiebar14 No problem - Please mark this thread as solved and give rep to those who helped you (By clicking the arrows etc..).

Are you creating a Forum? If so, it looks like your logic is a bit out, you should re-think this.

commented: I try to ask members to do that but most of the time they just ignore me +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.