6 Replies - 758 Views - Last Post: 13 December 2012 - 11:05 AM Rate Topic: -----

#1 EliteSins  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 12-December 12

How do I auto Generate Pages that includes user submitted info?

Posted 12 December 2012 - 07:07 PM

Like the title states, I need help with a websites that will have approx. 2 text boxes where users can enter information.

Then what needs to happen is a Page needs to be generated that already has a template and everything, but the information submitting on the previous page has to be included in the generated page.

Another thing that would be great is if the information submitted gets sent to my MySQl database, so that the same page can't be generated twice.

Thanks for the help in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: How do I auto Generate Pages that includes user submitted info?

#2 BenignDesign  Icon User is online

  • holy shitin shishkebobs
  • member icon




Reputation: 6118
  • View blog
  • Posts: 10,580
  • Joined: 28-September 07

Re: How do I auto Generate Pages that includes user submitted info?

Posted 12 December 2012 - 07:11 PM

This is not a task you'll be able to accomplish in HTML/CSS alone. You'll need a server-side scripting language to make this happen... like PHP or ASP and the like.
Was This Post Helpful? 0
  • +
  • -

#3 EliteSins  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 12-December 12

Re: How do I auto Generate Pages that includes user submitted info?

Posted 12 December 2012 - 07:12 PM

View PostBenignDesign, on 12 December 2012 - 07:11 PM, said:

This is not a task you'll be able to accomplish in HTML/CSS alone. You'll need a server-side scripting language to make this happen... like PHP or ASP and the like.



When i had the choice to select the catagory, there was no PHP catagory so yeah :/
Was This Post Helpful? 0
  • +
  • -

#4 EliteSins  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 12-December 12

Re: How do I auto Generate Pages that includes user submitted info?

Posted 12 December 2012 - 07:40 PM

Like the title states, I need help with a websites that will have approx. 2 text boxes where users can enter information.

Then what needs to happen is a Page needs to be generated that already has a template and everything, but the information submitting on the previous page has to be included in the generated page.

Another thing that would be great is if the information submitted gets sent to my MySQl database, so that the same page can't be generated twice.

Thanks for the help in advance!

SORRY I ALREADY POSTED THIS IN A DIFFERENT CATAGORY BUT I DIDNT KNOW AND I CANT DELETE IT!
Was This Post Helpful? 0
  • +
  • -

#5 BenignDesign  Icon User is online

  • holy shitin shishkebobs
  • member icon




Reputation: 6118
  • View blog
  • Posts: 10,580
  • Joined: 28-September 07

Re: How do I auto Generate Pages that includes user submitted info?

Posted 12 December 2012 - 07:58 PM

It's under Programming Help: http://www.dreaminco...s/forum/28-php/

I'll move the thread.
Was This Post Helpful? 0
  • +
  • -

#6 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2999
  • View blog
  • Posts: 10,383
  • Joined: 08-August 08

Re: How do I auto Generate Pages that includes user submitted info?

Posted 12 December 2012 - 10:24 PM

How do you want it included? If you just want to display the information you could do something like:
if(!empty($_POST['userdata'])) {
  echo htmlentities($_POST['userdata'])."<br>";
}

htmlentities will help guard against cross site scripting.
Was This Post Helpful? 0
  • +
  • -

#7 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 440
  • View blog
  • Posts: 1,867
  • Joined: 30-April 10

Re: How do I auto Generate Pages that includes user submitted info?

Posted 13 December 2012 - 11:05 AM

Do you have any experience with PHP at all? I will give you a description of what CAN be done:

Send information from the form using the method post to a file that will process the form data, this may also be the same page the from is on.
<form method='post' action='process.php'>
  <input type='text' name='input'/>
  <input type='submit' name='submit' value='Submit'/>
</form>


Notice that the form elements are using the name attribute. PHP uses name NOT id to send data via a form. This form will be sent with the method of post (you may use get also) to the process.php page.

Then clean the user data:
$input = strip_tags($_GET['input']);
//keep in mind there are may other things to use when sanitizing/using data entered by a user.



Then create a database to store the information in (MySQL).
To access this you will want to use MySQLi or PDO with prepared statements for added security.
//MySQLi OOP style
$myslqi = new mysqli('host', 'user', 'password', 'databaseName');//connection using OOP

//check connection
if (!$mysqli->connect_error){
  $stmt = $mysqli->prepare("INSERT INTO tableName('id','input') VALUES("", ?)");
  $stmt->bind_param("s", $input);
  if($stmt->execute()){
    //then you can retrieve your data and put it in the page.
  }
}else{
  print "Error" . $mysqli->error;
}



Retrieval is the same thing only you will make some changes to the prepared statement.

Take a look at the PHP.net manual for more on how this works.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1