Request

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Request

Post by bigdavemmu »

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


Hello all...

I have a HTML page that sends some data to a PHP page via a form. Send method is GET.

I have tried all the combinations known to man to get the data to print to screen in the PHP page, ie $_REQUEST, $_GET and changed the HTML so it posts the data and tried $_POST in the PHP page.

All I am trying to do is get it to write the sent data to screen but it's proving very difficult. Can someone please help.

The HTML page can be found at [url]http://www.candoslimming.com/members.html[/url] and the PHP is below:

Code: Select all

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3c.org/1999/xhtml" xml:lang="en" lang="en">


<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<meta name="generator" content="Adobe GoLive">
		<title>Check Database</title>
	</head>

	<body bgcolor="#ffffff">
		<?PHP
		echo "test"
		?>
		<br><br><br>
		<?PHP

		
// Connecting, selecting database
$link = mysql_connect(':/var/lib/mysql/mysql.sock', 'root', 'abc123')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully<br><br>';
mysql_select_db('login')
or die('Could not select database<br><br>');
echo 'Connected to LOGIN database<br><br>';

// Performing SQL query

$pinID = $_REQUEST['thepin'];

echo "'$pinID'";

//echo $pinID;

$query = "select * from `keys`";

$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
        echo "\t\t<td>$col_value</td>\n";
    }
    echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
 ?>
		
		
	</body>

</html>
Any help would be great.

Thanks

BigDave


Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

try doing

Code: Select all

print_r($_GET);
that should give you a bit of a start. i don't see why it is not actually working though. seams strange
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Not working

Post by bigdavemmu »

That isn't working either mate!

Do you have a clue whatsoever as to why this isn't working?? Could it be the server??

Thanks Again
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

make a seperate page with this in it

Code: Select all

<?
if (!empty($_POST['name']))
  echo 'Hello! You Entered '.$_POST['name'].' as your name';
else
{
  ?>
    <form action="name_of_this_page.php" method="post">
      Enter a name: <input type="text" name="name">
      <input type="submit" value="submit">
    </form>
  <?
}
just change the form action to the correct name of that page. see if that works
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Good idea

Post by bigdavemmu »

Good Idea Mate...

Unfortunately...It's not picking up the name that is passed accross. I don't know what to do. I don't manage the server so could this be a setting in the PHP.ini file that needs changing???

Cheers

:(
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

I have a suspicion, does print_r($HTTP_REQUEST_VARS) work :?:
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Nope

Post by bigdavemmu »

Nope...that gives me a parse error.

I have the file working on my local server (XP, running PHP v5.)

Is it possible that the server I'm using has an older version of PHP installed?

Thanks
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

do

Code: Select all

<?php

var_dump($_REQUEST);

?>
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

oh sorry! change that to $HTTP_GET_VARS
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Post by bigdavemmu »

That gives me the same parse error! Doh :(
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Post by bigdavemmu »

variable dump returns a null
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Which version of PHP are you running?
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

8O
bigdavemmu
Forum Newbie
Posts: 22
Joined: Wed Oct 26, 2005 4:01 am

Post by bigdavemmu »

how do i check my php version?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

phpversion()
phpinfo()

Your configuration may have turned off long vars...
Post Reply