473,385 Members | 1,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Referencing PHP_SELF variable within HTML Form - Problem...

all,

I am developing a simple web site that contains a form page. The
apps utilized are apache 2.0.48, php 4.3.4 on redhat 8.0. I have
built a simple web form with one text box and a submit button. The
result of pressing the submit button should be php echo'ing the input
back to the screen. Attached is the tiny code snippet below:

----------------------------------------------
<html>
<head><title>PHP Forms Example</title></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
Type a string: <input type="text" name="myString"><br>
<input type="Submit" name="submit" value="Submit
Journal"><br><br>
</form>
<?php
print "You typed: $myString";
?>
</body>
</html>
----------------------------------------------

The problem I am experiencing is that the print statement doesn't
print anything back to output. If you notice, I changed the reference
PHP_SELF due to 4.2.x modifications in php.ini.

Any ideas?
Mike
Jul 17 '05 #1
3 6210
mike m wrote:
----------------------------------------------
<html>
<head><title>PHP Forms Example</title></head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
Type a string: <input type="text" name="myString"><br>
<input type="Submit" name="submit" value="Submit
Journal"><br><br>
</form>
<?php
print "You typed: $myString";
?>
</body>
</html>
----------------------------------------------

The problem I am experiencing is that the print statement doesn't
print anything back to output. If you notice, I changed the reference
PHP_SELF due to 4.2.x modifications in php.ini.

Any ideas?
Mike


You probably have "register_globals" turned OFF.... which is now the
default.

Try : print "You typed:" . $_POST['myString'];

and see what you get.

Al Canton
Adams-Blake Company, Inc.
***
JAYA123 - the new web-based total-office system for the
small biz. Order entry, billing, bookkeeping, etc. for $14.95
a month. Everyone says "It's cool as a moose!!"
See why at:http://www.jaya123.com
***

Jul 17 '05 #2
mike m wrote:
The problem I am experiencing is that the print statement doesn't
print anything back to output. If you notice, I changed the reference
PHP_SELF due to 4.2.x modifications in php.ini.


Because of the same thing you have to change $mystring

Follow the other poster suggestion.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #3
Pedro Graca <he****@hotpop.com> wrote in message news:<bt************@ID-203069.news.uni-berlin.de>...
mike m wrote:
The problem I am experiencing is that the print statement doesn't
print anything back to output. If you notice, I changed the reference
PHP_SELF due to 4.2.x modifications in php.ini.


Because of the same thing you have to change $mystring

Follow the other poster suggestion.


All,

After reading this I was able to get this working. It helps to RTFM
in more depth :)

Thanks again for the quick response - I have dived into learning
(struggling) php over the past 2 days; the newsgroup participants have
been very helpful...

Rgds,
Mike M
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Salve Håkedal | last post by:
When I select Februar here and sends, selection returns to Januar. I know why: no option is marked selected... But can php get this right in an easy way? <html><head><title>Part of a bigger...
5
by: Maja | last post by:
here's situation: i have installed php 5 and apache 2.0. i can call my page with: localhost\\subdir\page.php inside my page i use links like this:
1
by: Michael Brennan-White | last post by:
If I submit my for using a get action the resulting page loads . If I use a post action I get an error page saying "The page cannot be found". I am calling the originating page!!! This happens...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
7
by: zek2005 | last post by:
Hi!!! I need to retrieve the information of a database in 2 steps. First, depending on the number of a branch, I have to show in a combo the commercial campaigns available for that branch. Then...
10
by: Jim Carlock | last post by:
Looking for a way to extract the path from the pfqpn (partially full qualified path name). $sThisServer = $_SERVER; // returns either aquaticcreationsnc.com or www.aquaticcreationsnc.com ...
5
by: Tom | last post by:
I have a function that restricts access to a page to logged in users. When a user who isn't logged in goes to the page, it will dynamically generate a login form. I'm trying to use it in...
4
by: Jim Carlock | last post by:
Are the XSS / Cross Site Scripting attacks fixed in Version 4.44? I'm seeing that $_SERVER doesn't return the $_SERVER appended to it. I was just messing with a few things and noticed that...
18
by: zoilus | last post by:
Can not determine how "<?=PHP_SELF?>" is supposed to work. The below is the line of code. <!-- <form name="search" method="post" action="<?=$PHP_SELF?>"--> When the above statement is run the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.