simple phpmyadmin question

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 960 Views - Last Post: 27 February 2017 - 02:11 PM

#1 Exceedinglife  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 01-July 12

simple phpmyadmin question

Posted 24 February 2017 - 08:12 PM

I have a very simple PHP program I am working on just to do some refreshing and I cannot get any echos to show up and also the data is not being inserted into the database. Can someone please tell me my error? Also for php debugging do I just add “error_reporting(-1);” in the PHP code?

Here is what I have for simple data.

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>login test</title>
		
	</head>
	<body>
		<form action="signup.php" method="POST">
			<input type="text" name="first" id="first" placeholder="first name" /><br>
			<input type="text" name="user" id="user" placeholder="user name" /><br>
			<input type="password" name="pass" id="pass" placeholder="password" /><br>
			<button type="submit">Sign up</button>
		</form>
	</body>
</html>

Conn.php
<?php
		
	$conn = mysqli_connect("localhost", "root", "", "test");
	
	if(!$conn) {
		die("Connection failed: " . mysqli_connect_error());
	}

Signup.php
<?php

	include 'conn.php';
	
	$first = $_POST['first'];
	$user = $_POST['user'];
	$pass = $_POST['pass'];
	
	echo $first;
	echo $user;
	echo $pass;
	
	$sql = "INSERT INTO user (first, user, pass) 
			VALUES ('$first', '$user', '$pass')";
			
	$result = mysqli_query($conn, $sql);
	
	header("Location: register.php");




Is This A Good Question/Topic? 0
  • +

Replies To: simple phpmyadmin question

#2 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2325
  • View blog
  • Posts: 9,345
  • Joined: 03-December 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 08:49 PM

Where is signup.php?
Was This Post Helpful? 0
  • +
  • -

#3 Exceedinglife  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 01-July 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 08:54 PM

all files are in the same folder no subfolders the folder is

conn.php
register.php
signup.php

all in the same directory
Was This Post Helpful? 0
  • +
  • -

#4 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2325
  • View blog
  • Posts: 9,345
  • Joined: 03-December 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 08:57 PM

When you submit the form, does it redirect to the registration page?
Was This Post Helpful? 0
  • +
  • -

#5 Exceedinglife  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 01-July 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:06 PM

the url goes to signup.php and when i right click and view source then i see all my php code but i cannot see anything that is echoed and nothing inserts into the database
Was This Post Helpful? 0
  • +
  • -

#6 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2325
  • View blog
  • Posts: 9,345
  • Joined: 03-December 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:07 PM

Hold on, you view source and see php code?
Was This Post Helpful? 0
  • +
  • -

#7 Exceedinglife  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 01-July 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:10 PM

No the header(register.php) is not bringing me back to the register page

yes

this is what i get brought to

http://127.0.0.1:8020/xxx/signup.php

and when i view source this is what i see

<?php

	include 'conn.php';
	
	$first = $_POST['first'];
	$user = $_POST['user'];
	$pass = $_POST['pass'];
	
	echo $first;
	echo $user;
	echo $pass;
	
	$sql = "INSERT INTO user (first, username, password) 
			VALUES ('$first', '$user', '$pass')";
			
	$result = mysqli_query($conn, $sql);
	
	header("Location: register.php");
?>


Was This Post Helpful? 0
  • +
  • -

#8 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2325
  • View blog
  • Posts: 9,345
  • Joined: 03-December 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:12 PM

That url only works for you by the way.


Create a new page and put the following in it. See if it gives the code or something else.

<?php phpinfo();

Was This Post Helpful? 0
  • +
  • -

#9 Exceedinglife  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 01-July 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:16 PM

a new page like add phpinfo() at the bottom of signup.php?
or when i go to register.php have that go to a new page in action with only phpinfo() in it?
Was This Post Helpful? 0
  • +
  • -

#10 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2325
  • View blog
  • Posts: 9,345
  • Joined: 03-December 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:22 PM

Like a new php page
Was This Post Helpful? 0
  • +
  • -

#11 Exceedinglife  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 01-July 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:26 PM

ok i did that and all i see is a blank screen and when i view source i get

<?php

phpinfo();
Was This Post Helpful? 0
  • +
  • -

#12 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2325
  • View blog
  • Posts: 9,345
  • Joined: 03-December 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 09:39 PM

Okay then...

Did you install xamp to give you a lamp server?
Was This Post Helpful? 0
  • +
  • -

#13 Exceedinglife  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 98
  • Joined: 01-July 12

Re: simple phpmyadmin question

Posted 24 February 2017 - 10:02 PM

So you think it could be my xampp installation? i can uninstall and reinstall it i run apache and mysql when i turn on xampp i just dont understand when i try to echo information to review it from a textbox that nothing comes up except a blank page...
Was This Post Helpful? 0
  • +
  • -

#14 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2325
  • View blog
  • Posts: 9,345
  • Joined: 03-December 12

Re: simple phpmyadmin question

Posted 25 February 2017 - 08:34 AM

Did you setup the Xampp install to run on a different port?


Go to: localhost/ and see what is displayed in the browser.
Was This Post Helpful? 0
  • +
  • -

#15 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1768
  • View blog
  • Posts: 5,636
  • Joined: 15-January 14

Re: simple phpmyadmin question

Posted 27 February 2017 - 12:44 PM

Quote

i just dont understand when i try to echo information to review it from a textbox that nothing comes up except a blank page...

Because the PHP code is not being executed by the server. If it was executed then you will see the output of the PHP code instead of the code itself. The browser should only get the output of the code, the browser does not understand PHP code, only the server does. The server should not send any PHP code to the browser. The question is why isn't the server executing the PHP code. I don't know the answer to that, if you access the server over HTTP and the files have .php extensions then maybe the server isn't configured properly to execute PHP code.
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2