Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Passing parameters from HTML to PHP
- Dave Kelly
September 26, 2006, 7:44 pm
rate this thread
understand why this failure.
I have put in some 'printf' statements for debugging and some comments.
And some questions.
From the menu.html page
<a href="guestbook.php?var1=list-PINSS.txt"><h3>Padre Island National
<a href="guestbook.php?var1=list-LHL.txt"><h3>Light House
<a href="guestbook.php?var1=list-7LD.txt"><h3>7 Lakes Damon</h3></a><br>
<a href="guestbook.php?var1=list-GR.txt"><h3>Guadalupe River</h3></a><br>
To the PHP file
include $_GET['var1']; //prints to screen the correct information
printf("-----%s", $var1); // prints nothing.
printf("+++++%s", $file); // prints to the screen the correct information.
if($mode!='view' && $mode!='sign') $mode=$_POST['mode'];
if($mode!='view' && $mode!='sign') $mode='sign';
$date=date('l, F dS, Y (g:i A T)');
printf(;// prints to the screen the correct information.
($handle=fopen($file,'a+') or die("Could not open file: $file"));// FAILS
This is the way it appears on the screen....
Sunday, September 24th, 2006 (4:10 PM CDT) Dafydd Cealleigh
email@example.com lets go fishing Sunday, September 24th, 2006
(4:30 PM CDT) Dave Kelly firstname.lastname@example.org Sunday, September
24th, 2006 (4:53 PM CDT) Jim Kloss email@example.com Sunday,
September 24th, 2006 (5:01 PM CDT) Wilson Harmon firstname.lastname@example.org 936 894
1710 Sunday, September 24th, 2006 (5:11 PM CDT) Alfred E Newman
Notice: Undefined variable: var1 in
/var/www/vhosts/texasflyfishers.org/httpdocs/guestbook.php on line 22
Why does $file contain 'list-PINSS.txt' in printf ("_____%s_____",
$file) and 'var1' in ($handle=fopen($file,'a+')?
Re: Passing parameters from HTML to PHP
What are you printing? Does the included file do it?
That's because $var1 isn't defined. Perhaps you're using an old text or
code that ran with register_globals enabled. That's a security hole,
and the default now is to have it turned off (as it should be).
instead, as you had it in the include statement.
$var1 = $_GET['var1'];
and your current printf will work.
Which method is your form using - GET or POST? One or the other.
It doesn't. That's an error message due to the uninitialized variable.
Looks like your logic is just a little messed up here.
Remove the "x" from my email address
JDS Computer Training Corp.
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum