Jump to content

Recommended Posts

<?php

$code = $_POST['code'];

$dbhost = "****";
$db = "****";
$dbuser = "****";
$dbpassword = "****";

//connecting to the database
$connect = mysql_connect("$dbhost","$dbuser","$dbpassword") or die("Connection failed!");
mysql_select_db("$db") or die("Database fail!");

//extract
$extract = mysql_query("SELECT * FROM info WHERE vipcode='$code'");
$numrows = mysql_num_rows($extract);

while ($row = mysql_fetch_assoc($extract))

{

if (!$row[levelofproject] || !$row[name] || !$row[id]){
   echo "Invalid code! <a href='http://www.srl.comoj.com'>Home</a>";
} else {

if ($row[progress] > 70) {
   $progress = "green";
}
       
echo "Progress: <span style='color:". $progress ."'>". $row[progress] ."%</span>";
}
}


?>

 

And my HTML code:

 

<link rel="stylesheet" type="text/css" href="style.css" />
<br><br><form action='info.php' method='POST'><input type='text' name='code' size='16' align='center'><a href='info.php' type='submit'><img src='Go.png' align='center' border='0'></a></img></form>

<Br><br><br><br><br><b><font family='arial'>Warning: Best viewed in Google Chrome</font></b>

 

When I type in a number, and then click the button it sends me to a blank page.......? It DOES send me to info.php, but it's a blank page....

[/code]

Link to comment
https://forums.phpfreaks.com/topic/193284-displays-nothing/
Share on other sites

Hi Justin,

Using a hyperlink to a php page will not submit form data, so when your link goes to info.php there is no form data. The SQL statement therefore will be

 

SELECT * FROM info WHERE vipcode=''

 

which will return no results unless you have a record with a null code value. The conditional statement

 

if (!$row[levelofproject] || !$row[name] || !$row[id]){

 

therefore fails and nothing is output to the screen.

 

All the best,

Fergal

You need to use a proper method of submitting the form, either a submit input or javascript and put a form action with info.php as the value in the form tag.

Fergal

Link to comment
https://forums.phpfreaks.com/topic/193284-displays-nothing/#findComment-1017754
Share on other sites

We don't know what's on info.php.... is it the first block of code you posted? If so, there may be no records in your database, or an error on the page.

 

Try this:

ini_set('display_errors', E_ALL);

display_errors(1);

 

And also print out some debugging info on that page...

Link to comment
https://forums.phpfreaks.com/topic/193284-displays-nothing/#findComment-1018238
Share on other sites

The code can't find the function display_errors().

Maybe you forgot to include the function in info.php

Or made a type mistake in the function name.

It just cant find the function.

If you call a function name that does not exist. You will get this error.

I think that is the solution.

Hope you will get it to work :)

 

Link to comment
https://forums.phpfreaks.com/topic/193284-displays-nothing/#findComment-1018267
Share on other sites

The code can't find the function display_errors().

Maybe you forgot to include the function in info.php

Or made a type mistake in the function name.

It just cant find the function.

If you call a function name that does not exist. You will get this error.

I think that is the solution.

Hope you will get it to work :)

 

I'm not sure of what might be wrong. I'll look though. :)

Link to comment
https://forums.phpfreaks.com/topic/193284-displays-nothing/#findComment-1018276
Share on other sites

 

<?php

if (isset($_POST['submit']))
{

  $code = isset($_POST['code']) ? intval($_POST['code']) : 0;

  $dbhost = "****";
  $db = "****";
  $dbuser = "****";
  $dbpassword = "****";

  //connecting to the database
  $connect = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection failed!");
  mysql_select_db($db, $connect) or die("Database fail!");

  //extract
  $extract = mysql_query("SELECT * FROM info WHERE vipcode='$code'")or die("Error with query: " . mysql_error());
  $numrows = mysql_num_rows($extract);

  if ($numrows != 0)
  {
    echo "Invalid code! <a href='[url=http://www.srl.comoj.com]http://www.srl.comoj.com[/url]'>Home</a>";
  } else {

    while ($row = mysql_fetch_assoc($extract))
    {

      if ($row['progress'] > 70) {
         $progress = "green";
      }
       
    echo "Progress: <span style='color:". $progress ."'>". $row['progress'] ."%</span>";
    }
  }
}
?>

 

<link rel="stylesheet" type="text/css" href="style.css" >
<br >
<br >
<form action='info.php' method='POST'>
  <input type='text' name='code' size='16'>
  <input type='submit' name='submit' value='Go'>
</form>

Link to comment
https://forums.phpfreaks.com/topic/193284-displays-nothing/#findComment-1018309
Share on other sites

try

<link rel="stylesheet" type="text/css" href="style.css" />
<br><br>
<form action='info.php' method='POST' name='myform'>
<input type='text' name='code' size='16' align='center'>
<a href='javascript: document.myform.submit()' type='submit'>
	<img src='Go.png' align='center' border='0' />
</a>
</form>
<br><br><br><br><br>
<b><font family='arial'>Warning: Best viewed in Google Chrome</font></b>

Link to comment
https://forums.phpfreaks.com/topic/193284-displays-nothing/#findComment-1018392
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.