Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

newbie to PHP

Status
Not open for further replies.

Murugs

Technical User
Joined
Jun 24, 2002
Messages
549
Location
US
My simple HTML form goes like this

<HTML>
<BODY BGCOLOR = &quot;#FFFFFF&quot;>
<H1> A Simple Form </H1>
<FORM ACTION = &quot;process1.php&quot; METHOD = &quot;post&quot;>
Enter Your Name:
<INPUT TYPE = &quot;text&quot; NAME = &quot;student&quot;> <BR>
Select Your Grade Level:
<SELECT NAME = &quot;grade&quot;>
<OPTION SELECTED > 12
<OPTION> 11
<OPTION> 10
<OPTION> 9
</SELECT> <BR>
<INPUT TYPE=&quot;submit&quot; VALUE = &quot;Submit&quot;>
<INPUT TYPE=&quot;reset&quot; VALUE = &quot;Clear&quot;>
</BODY>
</HTML>

and my process1.php goes like this

<HTML>
<BODY BGCOLOR = &quot;#FFFFFF&quot;>
<H1> Processing the Form </H1>
<?
print(&quot;Hi $student! <BR>&quot;);
print(&quot;You are in grade $grade. <BR>&quot;);
$graduate = 2001 + (12 - $grade);
print(&quot;You will graduate in the year $graduate.&quot;);
?>
</BODY>
</HTML>

When I press submit on my HTML form nothing is displayed on screen..any suggestions..I have installed PHP and some other sample scripts are running fine...could any one explain..
Also could anyone explain how to pass this simple form information to a text file.
regards
MP
 
Your setting of the runtime configuration directive is &quot;off&quot;. This is the new default.


Instead of referencing $elementname, reference (in the case of your POST-method form) $_POST.

So instead of:

print(&quot;You are in grade $grade. <BR>&quot;);

do:

print(&quot;You are in grade &quot; . $_POST['grade'] . &quot;.<BR>&quot;);

For more information:


Want the best answers? Ask the best questions: TANSTAAFL!!
 
thanks for the valuable tip
 
new versions of php use $_POST or $_GET to access the form values

$STUDENT=$_post['STUDENT']

ETC

Bastien

cat, the other other white meat
 
Also... i dunno if using the print command is neccisary here..

Top of php form:
$student = $_POST['student'];
$grade = $_POST['grade'];

Where youre printing:

echo &quot;Welcome $student <br>&quot;;
echo &quot;You are in grade $grade <br>&quot;;

note this will NOT work

echo 'Welcome $student <br>';
echo 'You are in grade $grade <br>';



' = do exactly.

&quot; = process the info.

so to use ' it would be..

echo 'Welcome '.$student.' <br>';



little tip here also if yr echoing quotes lik for html



echo &quot;<font color='#ffffff' size='3'>&quot;;

do it like that or vise versa use the opposite of what your using for the echo.



just few tips im fairly new as well but think im getting it pretty good :D

in the begining man created code.
in the end code will create man.
clones are coming only matter of time.
examples?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top