how to get output based on a Webform the user filled out?

by abdel
10 replies
Hello,

I have a webpage with a 3 fields webform inside.
The user will have to fill in the form and to click the button "generate".
The output will be the same page with some differrences based on his 3 inputs:
- input#1 will generate a specific user URL, ex: ww.webpage.com/userID
- input#2 will remplace a word in the webpage content
- input#3 will remplace another word in the webpage content

Thanks.
#based #filled #output #user #webform
  • Profile picture of the author Lani
    Originally Posted by abdel View Post

    Hello,

    I have a webpage with a 3 fields webform inside.
    The user will have to fill in the form and to click the button "generate".
    The output will be the same page with some differrences based on his 3 inputs:
    - input#1 will generate a specific user URL, ex: ww.webpage.com/userID
    - input#2 will remplace a word in the webpage content
    - input#3 will remplace another word in the webpage content

    Thanks.
    Best way to do this is to save user submitted data to MySql database and when user visits ww.webpage.com/userID it loads content from database by user id.

    You need to edit .htaccess so you site understands that "userID" is variable on url, else it will give 404 error.

    Send me your code and I can work something out
    {{ DiscussionBoard.errors[9068049].message }}
    • Profile picture of the author abdel
      Originally Posted by Lani View Post

      Best way to do this is to save user submitted data to MySql database and when user visits ww.webpage.com/userID it loads content from database by user id.

      You need to edit .htaccess so you site understands that "userID" is variable on url, else it will give 404 error.

      Send me your code and I can work something out
      Hello Lani, thank you,

      Sorry, I meant I have the content for a webpage I plan to publish online.
      So, I haven't the code yet because I am not a developer,
      I am just an internet marketing newbie,
      who is looking for some help to generate his first dollars through internet.

      I can insert and edit the content by myself once I have the said code.
      I can do it by using Kompozer for example.

      The content is just some text lines.
      The text will include 2 variables.
      And somewhere between the text lines there is a 3 fields form.
      The 3rd variable is for the end-user URL as I said.

      I will be very grateful if you can help me to have the basic structure of
      the said code where I will be able to add and edit my text lines.

      By the way, I have a domain name and hosting account at Hostgator.

      Thanks once more again,
      {{ DiscussionBoard.errors[9069154].message }}
    • Profile picture of the author brutecky
      Originally Posted by Lani View Post

      Best way to do this is to save user submitted data to MySql database and when user visits ww.webpage.com/userID it loads content from database by user id.

      You need to edit .htaccess so you site understands that "userID" is variable on url, else it will give 404 error.

      Send me your code and I can work something out
      OP .. its going to be very difficult to explain how to do this since it seems you have not coding experience. However dont listen to this guy. His solution is over complex.
      {{ DiscussionBoard.errors[9072549].message }}
      • Profile picture of the author Lani
        Originally Posted by brutecky View Post

        OP .. its going to be very difficult to explain how to do this since it seems you have not coding experience. However dont listen to this guy. His solution is over complex.
        Whats complex about website storing data to database? I'd say its pretty normal

        Originally Posted by abdel View Post

        Thanks,

        Now I have created a php page where I inserted the code you gave here,
        then I added some content.
        I also created MySql database to connect it to the said php page.
        But I don't know how. Can you please tell me how to connect
        my php page to my MySql database?

        Thanks once more again.
        Index.php is frontpage of your website.
        Frontpages of websites is called "index".

        On index.php and get_data.php there is line

        $db = new PDO('mysql:host=127.0.0.1;dbname=mysql_table', 'mysql_user', 'mysql_pass');

        Replace "mysql_table" with your database name, "mysql_user" with your mysql username and "mysql_pass" with password.

        Before that, go to phpmyadmin and select database you have created and go to sql tab and run whats in "db schema" link.

        Here is picture:
        http://i.imgur.com/SajM4C9.png

        But as brutecky said, its a bit hard to explain some things for non coders and Im sure that google gives some answers faster
        {{ DiscussionBoard.errors[9072705].message }}
        • Profile picture of the author abdel
          Originally Posted by Lani View Post

          Whats complex about website storing data to database? I'd say its pretty normal


          Index.php is frontpage of your website.
          Frontpages of websites is called "index".

          On index.php and get_data.php there is line

          = new PDO('mysql:host=127.0.0.1;dbname=mysql_table', 'mysql_user', 'mysql_pass');

          Replace "mysql_table" with your database name, "mysql_user" with your mysql username and "mysql_pass" with password.

          Before that, go to phpmyadmin and select database you have created and go to sql tab and run whats in "db schema" link.

          Here is picture:
          http://i.imgur.com/SajM4C9.png

          But as brutecky said, its a bit hard to explain some things for non coders and Im sure that google gives some answers faster
          Hi,
          I followed all the steps here above,
          But when I tried to test the page by filling the form in and submitting it,
          I got 3 differents WARNING messages in once, see below:
          Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'sahar'@'localhost' (using password: NO) in /home2/sahar/public_html/smartlist/index.php on line 9

          Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home2/sahar/public_html/smartlist/index.php on line 9

          Warning: Cannot modify header information - headers already sent by (output started at /home2/sahar/public_html/smartlist/index.php:9) in /home2/sahar/public_html/smartlist/index.php on line 34
          I don't know how to deal with those warnings. Any help please?
          Thanks.
          {{ DiscussionBoard.errors[9082305].message }}
  • Profile picture of the author tweakr
    Seeing that you're hosting the site on hostgator, I'm going to assume that you're going to use PHP to complete the task. With this in mind I put together a brief example that should get you started.
    {{ DiscussionBoard.errors[9069260].message }}
    • Profile picture of the author abdel
      Originally Posted by tweakr View Post

      Seeing that you're hosting the site on hostgator, I'm going to assume that you're going to use PHP to complete the task. With this in mind I put together a brief example that should get you started.
      Thanks,

      Now I have created a php page where I inserted the code you gave here,
      then I added some content.
      I also created MySql database to connect it to the said php page.
      But I don't know how. Can you please tell me how to connect
      my php page to my MySql database?

      Thanks once more again.
      {{ DiscussionBoard.errors[9069352].message }}
  • Profile picture of the author Lani
    Here is simple example I made for you.

    index.php
    get_data.php
    .htaccess
    DB Schema

    Hope this helps you to get started
    {{ DiscussionBoard.errors[9069344].message }}
    • Profile picture of the author abdel
      Originally Posted by Lani View Post

      Here is simple example I made for you.

      index.php
      get_data.php
      .htaccess
      DB Schema

      Hope this helps you to get started
      Hello Lani,

      First, I appreciate the examples you have posted here. Thanks.
      But I don't know how to use each one of them:
      which one will be my webpage?
      which one is the configuration file?
      etc..

      And can you please give me an idea on how to connect
      the MySql database I have created to my webpage?

      Thank you very much.
      {{ DiscussionBoard.errors[9072537].message }}

Trending Topics