You are here: Passing parameters from HTML to PHP « PHP Programming Language « IT news, forums, messages
Passing parameters from HTML to PHP

Posted by Dave Kelly on 09/26/06 19:44

I'm posting on this again. Sorry I am so thick heading but I do not
understand why this failure.

I have put in some 'printf' statements for debugging and some comments.
And some questions.

From the menu.html page

<html>
<a href="guestbook.php?var1=list-PINSS.txt"><h3>Padre Island National
Sea Shore</h3></a><br>
<a href="guestbook.php?var1=list-LHL.txt"><h3>Light House
Lakes</h3></a><br>
<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>
</html>

To the PHP file
<?php

include $_GET['var1']; //prints to screen the correct information
$file=$_GET['var1'];

printf("-----%s", $var1); // prints nothing.
printf("+++++%s", $file); // prints to the screen the correct information.

error_reporting(1);
$mode=$_GET['mode'];
if($mode!='view' && $mode!='sign') $mode=$_POST['mode'];
if($mode!='view' && $mode!='sign') $mode='sign';
$name=$_POST['name'];
$site=$_POST['site'];
$phone=$_POST['phone'];
$date=date('l, F dS, Y (g:i A T)');
$self=$_SERVER['PHP_SELF'];
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
daveecealleig@ireland.nat lets go fishing Sunday, September 24th, 2006
(4:30 PM CDT) Dave Kelly daveecealleig@ireland.nat Sunday, September
24th, 2006 (4:53 PM CDT) Jim Kloss daveecealleig@ireland.nat Sunday,
September 24th, 2006 (5:01 PM CDT) Wilson Harmon will@harmon.cum 936 894
1710 Sunday, September 24th, 2006 (5:11 PM CDT) Alfred E Newman
49wist@vista.fiv 1234483298374

Notice: Undefined variable: var1 in
/var/www/vhosts/texasflyfishers.org/httpdocs/guestbook.php on line 22

-----+++++list-PINSS.txt_____list-PINSS.txt_____

Why does $file contain 'list-PINSS.txt' in printf ("_____%s_____",
$file) and 'var1' in ($handle=fopen($file,'a+')?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация