RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting

Learning PHP but problem with script

Join Date: Mar 2004
Posts: 4
Reputation: wise1 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
wise1 wise1 is offline Offline
Newbie Poster

Solution Re: Learning PHP but problem with script

  #9  
Mar 15th, 2004
Aplogies, I should have stated that this is the code straight form the book, or the cd at least.

I typed it all myself to learn the concept of the script using my own domain, etc.....

The way the book taught me was this, so you understand.

First I created a form in HTML and saved that file as entermail.html, the form action was to call a script called sendemail.php which had the script to send the email after getting the values from the entermail.html

So that was two scripts to send the e-mail.

It then goes on to show you (the script above) how to create just 1 file to setup the form and send the mail. The above script is not working even if I put in my domain details.

Ignore my ignorence here but this is what I thought strange.

There is a hidden field in the scripts $form_block area called "op" (operation)
That field has a value of "ds" (do something)

So basically what the book is saying is that when you run the script the first time it shows the form as the "op" field has a value of "ds", you can then enter your details in the form.

Following me so far?

Okay so the form action in the script has a value of

$_SERVER[PHP_SELF]

this tell me that your going to run the script again upon the user pressing the submit butotn on the form.

So what should happen now is that the value of "op" should now be not equal (!=) to ds, this would then mean that the script has been run to collect the data and you now want to send the mail and output the "mail sent" message.

So if the value of "op" is not "ds" then the form will not be displayed.

But there is at no point in the script an option to change the value of "op" so how can it tell if something has happened to cause it not to display?

As I say I am new to this but thats my thoughts, anyone care to at least shoot me down and say I am talking rubbish.

:cheesy:
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 4:18 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC