Re: query string passing woes........ help... please....



rcoan@xxxxxxxxxxxxxxxxxx wrote:
If I use this in my html page will it pass the emailaddress to the php
page?

If you want to use php in the html file, you need to reconfigure your
server to parse all html files for php code, so not to increase system
load, keep php in php files.

I assume you rename the contact.html to contactform.php

<?php
$passedemail = $_GET['emailaddress'];
?>

this works only if you call the page with a link

contactform.php?emailaddress=theaddress@xxxxxxxxxxx

<form method="POST" action="contact.php">
<input type="text" name="passedemail" value="<?php echo $passedemail; ?
" >

The echo will work, if the file is a php file.


Then on the php page could I use this?

$EmailTo = $_POST['passedemail'];

Yes, that part will work.


My problem is (i think) that the query string won't pass to the php
page so if I bring it in the html page and convert it to a variable
can't i then send it to the php page? Am I looking at this all
wrong? I guess I'm just having trouble grasping the big picture here.

It's quite simple, files ending with .htm/.html will not be by default
get the php parsed, that will only happen in files ending with .php
(there can be others too like .php3/.php4./.php5/.phtml, depending on
the installation used).


--

//Aho
.



Relevant Pages

  • Re: Writing data to HTML file BEFORE the tag.
    ... which then appends the user comments to the ... end of the HTML file on which the form is located. ... This PHP code ... The exit call here will prevent the script from returning a complete ...
    (comp.lang.php)
  • Re: HTML/PHP include files
    ... not sure if this is the problem but your two php files are different: ... see if its the problem by copying your includes dir to the jennifer dir and ... or use the absolute paths above(make sure to delete jennifer/includes so you ... I thought that I could include an html file from a php statement ...
    (alt.html)
  • Re: Can PHP be used to write permanent file changes?
    ... perl, php, cgi or something else so I was wondering what you would ... write the new html file on the server? ... Something to process user submissions and store them ... PHP has no problem writing an HTML file ...
    (php.general)
  • Re: Change included code
    ... Index.php is basically an html file uses a linked css file and when its included in the new file its referencing a css file in the wrong spot. ... It would actually be a bit more trouble since any time I want to upload to the server to test I will have to change the link. ... Would be easier just to have php just add "../" to one spot instead manually doing it every time I upload to the server. ...
    (comp.lang.php)
  • Re: Change included code
    ... its included in the new file its referencing a css file in the ... upload to the server to test I will have to change the link. ... be easier just to have php just add "../" to one spot instead ... in the main html file I have ...
    (comp.lang.php)