LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 02-13-2003, 03:29 PM   #1
rhuser
Member
 
Registered: Jan 2003
Posts: 55

Rep: Reputation: 15
problems running php script


I have been tryin to do this for a long time but no luck, so i decided to format the system again and start again.

I am tryin to set up a web server with PHP and MySQL.

I installed a fresh install of Red hat8. and after configuring the Network. i tested the server, and it worked fine.

http://134.36.16.12

when i tested php, it displayed ok.

http://134.36.16.12/phpinfo.php

Following this i tried to test PHP, with a basic script
------------------------------
inputform.php

<?php

$myvar = "Hello World, $firstname";

echo $myvar;
?>
------------------------------

form1.html

<HTML>
<BODY>

<FORM ACTION="inputform.php" METHOD=post>

First Name <INPUT TYPE=TEXT NAME="firstname" SIZE=30><BR>
<INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit">

</FORM>
</BODY>
</HTML>

-------------------------

The output i got is simply Hello world.

http://134.36.16.12/inputform.php

I really require help as i am tryin to work on this project and i am stuck at the setting up.

Any Help appreciated.

Regards
 
Old 02-13-2003, 03:59 PM   #2
importboy03
Member
 
Registered: Feb 2003
Location: NorthEast
Distribution: RH 8.0
Posts: 34

Rep: Reputation: 15
Although I never use PHP, I look it up on the web. Here is the syntax for ur inputform.php

This should work for u

<?php echo $_POST["firstname"]; ?>.


I think your concatenate method below is wrong. Check out the syntax for it.
<?php

$myvar = "Hello World, $firstname";

echo $myvar;
?>

or Assumming ur syntax is correct... try this:

<?php

$myvar = "Hello World, $_POST["firstname"]";

echo $myvar;
?>

Last edited by importboy03; 02-13-2003 at 04:09 PM.
 
Old 02-13-2003, 10:25 PM   #3
turnip
Member
 
Registered: Jul 2002
Posts: 143

Rep: Reputation: 15
You can also go into the php.ini file and turn on register globals. That should fix it. But at a cost of security. Read up more on it at php.net
 
Old 02-13-2003, 11:37 PM   #4
amish_geek
LQ Newbie
 
Registered: Feb 2003
Location: Duluth MN
Distribution: Debian, FreeBSD, SuSE
Posts: 23

Rep: Reputation: 15
SAMS PHP and MySQL Web Development book is an excellent resource. You can pick it up at Amazon.com or Barnes and Noble, or email me and I'll send you a link to the PDF version of it
 
Old 02-14-2003, 09:02 AM   #5
rhuser
Member
 
Registered: Jan 2003
Posts: 55

Original Poster
Rep: Reputation: 15
Fatal Error: running mysql_connect()

I am getting a fatal error when i try to submit data to my Mysql using php.

http://134.36.16.12/submitform.html is the page
the php is as folows:

<html>
<body>
<?php

mysql_connect (localhost, user, pass);

mysql_select_db (dbname);

mysql_query ("INSERT INTO tablename (first_name, last_name)
VALUES ('$first_name', '$last_name')
");

print ($first_name);

print (" ");

print ($last_name);

print ("<p>");

print ("Thanks for submitting your name.");

?>
</body>
</html>
 
Old 02-14-2003, 01:01 PM   #6
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Works fine for me now
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cron NOT running php script ??!! hendrixx Linux - Software 2 11-15-2006 07:18 AM
libmysqlclient error when running a php script rose_bud4201 Linux - Software 2 06-03-2005 01:43 PM
cron NOT running php script ??!! hendrixx Programming 1 01-19-2005 05:36 AM
php script not running in FC2 benjam Fedora 2 08-09-2004 02:47 PM
'method not allowed' when running any php script... :( _MD_ Linux - Software 3 04-17-2004 08:13 PM


All times are GMT -5. The time now is 02:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration