Registration Form with PHP - Page 1 -...

User 514723 Photo


Registered User
25 posts

Hello, I have this php i want to add to a file:
<?php
include 'mysqlconnect.php';

$register_attempt=0;
if(isset($_POST['register'])){$register_attempt=$_POST['register'];}
if ($register_attempt == 1)
{

$db = mysql_select_db("linksave", $con);

if (!$db)
{
die('Can not Connect to Database: ' . mysql_error());
}

$first_name =$_POST['firstname'];
$last_name =$_POST['lastname'];
$username =$_POST['username'];
$password =$_POST['password'];
$email_address =$_POST['email'];
$country =$_POST['country'];
$state =$_POST['state'];
$city =$_POST['city'];
$address =$_POST['address'];
$age =$_POST['age'];
$user_ip =$_SERVER['REMOTE_ADDR'];

$sql="INSERT INTO members (first_name, last_name, username, password, email, country, state, city, address, age, user_ip)
VALUES
('$first_name','$last_name','$username',MD5('$password'),'$email_address','$country','$state','$city','$address','$age','$user_ip')";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header('location:linksave.php');

mysql_close($con)

;}

?>


It pretty much gets information in a form and sends it to a mysql database, in my case WAMP, does anyone know which file i should put this code into to make it work?
User 187934 Photo


Senior Advisor
20,238 posts

Hi David,
Form builder has this functionality already built in.;)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 514723 Photo


Registered User
25 posts

I cant get it to work Eric, 1 thing i don't understand is how does the form know where to put each piece of info, so if i have a email address field, how does it know to put whatever's in the email address into the right spot in the database, if that makes sense?

Also i am not sure of the info to connect to the database, i think it's this:
Server: localhost
Port: 3306
Username: root
Password: *empty*
Database Name: unusuall_encounters
Table Name: users

But that didnt add anything into wamp, any ideas on what i might be doing wrong?
User 187934 Photo


Senior Advisor
20,238 posts

You need to make your data base on your server first. Then the form builder will populate it with the data.

This may help
http://www.coffeecup.com/forums/web-for … post184336
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 514723 Photo


Registered User
25 posts

Hello Eric, ive got a database on WAMP, does that class as on my server?
Also i was just looking at the "properties" tab in WFB and there is a field called "name" is that what i use to link parts of the form to parts of my database?
User 187934 Photo


Senior Advisor
20,238 posts

Setting this up in WAMP might be a little different but it should work.
Where are you finding the properties tab?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 464893 Photo


Ambassador
1,611 posts

It must be the settings tab he is talking about
The Guy from OZ


User 514723 Photo


Registered User
25 posts

the properties tab in WFB, what i don't understand about this process, is when you hit submit on a form, that data doesn't just magically know where it belongs in the database, there must be something in web form builder to link each and every field in the form to one in the database, but i cant find it and thought it might be the 'name field' in the properties tab up the top right hand corner...

Also, does anyone know if s-drive takes time to update? I have edited my form and re-uploaded, but my site is still showing the old form for some reason?
Yes the MySQL database will have the element names for the columns at the top when the form is submitted.
User 187934 Photo


Senior Advisor
20,238 posts

At the top of WFB click on settings then "Saving Data". Check the "Save to a MySQL Database" then enter your info.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 514723 Photo


Registered User
25 posts

hmm :/ thanks eric, but my second post pretty much states i have already done this, i will open a support ticket, hopefully the people that built this software can help me with it...

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.