Dear all
I have a few questions. I would be grateful if you could take the time to answer.
I have installed on windows xp home apache2, php 5 and mysqlserver 5. The http://localhost page of apache works fine.
The <?php echo phpinfo(); ?> page works fine. However when i am trying to query a database i have in mysql i get a blank page.
I cannot find what is the problem.
For example:
html>
<body>
<?php
$host = "localhost";
$user = "user";
$pass = "hello";
$connect = mysql_connect($host, $user, $pass) or die("Could not connect to mysql server");
mysql_create_db("test") or mysql_error();
?>
</body>
</html>
I am getting back a blank page.
I've also noticed the following problem
<HTML>
<FORM>
Please type your name here:<BR>
<INPUT TYPE="TEXT" NAME="username"><BR><BR>
<INPUT TYPE=SUBMIT VALUE="Submit data">
You typed:
<?php
echo ($username);
?>
</FORM>
</HTML>
I use the above test.php script located in apache's htdocs. However although i can see the value i submit in the url of the page
i can't see it after the string You typed:
I put both examples so maybe someone could tell me what to try.
Many thanks in advance
Cheers

The second page won't work because the <form> needs an method=POST and action=page.php added to it. A HTML page is static. You won't get the value you typed, unless you process it on the next page.

index.html:

<form action="process.php" method="POST">
<input type="text" name="mytext">
<input type="submit">
</form>

process.php:

<?php
  $mytext = $_POST["mytext"];
  echo "You typed: $mytext";
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.