Jump to content

Point me in the right direction, please.


sycik

Recommended Posts

Hey, I'm still a beginner with both PHP and mySQL, I was wondering if someone could help me solve this problem.

 

Basically what I want, is a form on my page. The particular form, can be filled out by any website visitor, when it is filled out, I want the results to immediately appear on the same page after the submit button is pressed.

 

How can I accomplish this with both php and mysql?

Link to comment
https://forums.phpfreaks.com/topic/138494-point-me-in-the-right-direction-please/
Share on other sites

$formCreation = Search Forums create form with php

$result = Search forums > create form with php and mysql //first step

 

  As if you're beginning in php, you sould learn this first...to write out one line to a file first.

 

Please don't take this wrong, but you said "beggining, and that is how to begin.

gevans??

 

Did you read what he wrote?

 

Basically what I want, is a form on my page.

 

  And that he is a beginner?  How can he pull data from a database, that more than likely doesn't exist, and what he said...he doesn't even know how to make a form yet? :-)

 

And then he says: I want the results to immediately appear on the same page after the submit button is pressed.

 

  In order to do this "immediatley", without refreshing...He'd also need to know JS and AJAX, let alone learning how to call another page yet..

 

 

Jim

Well what you would do is this:

 

<?php

if(isset($_POST['submit'])) // The button HTML name if it is pressed eg. they clicked on it
{
  $fields = array();
  $fields[0] = $_POST['name'];
  $fields[1] = $_POST['lastname'];

  return $fields;
}
else // They didnt submit anything
{
  echo 'You must fill out the application before we can display your information';
}

?>

 

if you want to save the information on a database all you need to do is query the information to the correct table with the proper credentials.

 

Between the brackets [''] the name of the html field would go there. So if you name the field "FirstName" then in your php you would do ['FirstName']. Note: PHP is case-sensitive so FirstName and firstname is different. Likewise, FiRsTnAmE is also different.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.