943,877 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 642
  • PHP RSS
Jan 1st, 2009
0

php contact form help needed plz

Expand Post »
Hello guys .. how r u ..

i am new to php (since we didnt get much php at university)
i am using it mainly to include the navigation menu, header, footer etc ..

i am working a on a contact form ..
people can send e-mails using a form even if it is not connected to
a datbase using something like:

PHP Syntax (Toggle Plain Text)
  1. <form action="http://www.is.nl/cgi-bin/mailto.exe" method="post">


instead of for example:

PHP Syntax (Toggle Plain Text)
  1. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

i tried using the first one i mentioned .. but it doesnt validate ..

does anyone know i can let it validate the form and use such a way to send e-mails
without connecting to a database?

thanks in advance
Reputation Points: 10
Solved Threads: 0
Light Poster
Modo is offline Offline
35 posts
since Oct 2008
Jan 2nd, 2009
0

Re: php contact form help needed plz

Click to Expand / Collapse  Quote originally posted by Modo ...
Hello guys .. how r u ..

i am new to php (since we didnt get much php at university)
i am using it mainly to include the navigation menu, header, footer etc ..

i am working a on a contact form ..
people can send e-mails using a form even if it is not connected to
a datbase using something like:

PHP Syntax (Toggle Plain Text)
  1. <form action="http://www.is.nl/cgi-bin/mailto.exe" method="post">

instead of for example:

PHP Syntax (Toggle Plain Text)
  1. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

i tried using the first one i mentioned .. but it doesnt validate ..

does anyone know i can let it validate the form and use such a way to send e-mails
without connecting to a database?

thanks in advance
Hi,
You have to validate your whole form by passing values to javascript while submitting your form and then you may pass the values to any other php program thru action. If you want to pass values to another php then use session variables and use header() function instead of using action="" in form.


PHP Syntax (Toggle Plain Text)
  1. <?
  2. session_start();
  3. if(isset($_POST['Submit']))
  4. {
  5. $_SESSION['name']=$_POST['Name'];
  6. ....................
  7. ...................
  8. ................
  9. header('Location: youphp.php');
  10. }
  11. ?>
  12. <html>
  13. <head>
  14. function ValidateForm()
  15. {
  16. //validate your form
  17. return true;
  18. }
  19. </head>
  20. <body>
  21. <form name="form1" method="post" action="" onSubmit="return ValidateForm();">
  22. //get all your data like Name,Email etc
  23. <input type="submit" name="Submit" value="Submit">
  24. </form>
  25. </body>
  26. </html>
Reputation Points: 10
Solved Threads: 1
Newbie Poster
ashafaaiz is offline Offline
20 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Setting mutiple vars in one var
Next Thread in PHP Forum Timeline: Hi I need to data search by php





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC