Php "GET" function
Moderator: General Moderators
-
polosport6699
- Forum Commoner
- Posts: 35
- Joined: Wed Jun 11, 2003 3:19 pm
Php "GET" function
I have been developing a database and I want to have a user fill out a form, then use the "GET" method of posting to send the information to the browser,
Can you have that link automaticly sent to email using a script or mailto:???
This link below is in my browser window. Can i somehow send that value (link) to an email address? Any help is throughly appreaciated
http://localhost/jobcentral/output.php? ... mit=submit
Can you have that link automaticly sent to email using a script or mailto:???
This link below is in my browser window. Can i somehow send that value (link) to an email address? Any help is throughly appreaciated
http://localhost/jobcentral/output.php? ... mit=submit
yes
Yes you can using a php script that is using mail()
http://ca2.php.net/manual/en/ref.mail.php
phpScott
http://ca2.php.net/manual/en/ref.mail.php
phpScott
-
polosport6699
- Forum Commoner
- Posts: 35
- Joined: Wed Jun 11, 2003 3:19 pm
I know
I know that I can send mail using php but I do not know how to get the url address into a variable format to send in the email. Do you understand my dilemma
The information submitted by your form will be in the $_POST array, with your <input> names as the keys.
You will need to then concatinate the values in this array and build up your URL, which you could then echo to the browser or mail using the mail() method (as per the reply by phpScott).
Is the intention to allow the recipient of the email to click on the link ??
Or have we lost the plot
Regards,
You will need to then concatinate the values in this array and build up your URL, which you could then echo to the browser or mail using the mail() method (as per the reply by phpScott).
Is the intention to allow the recipient of the email to click on the link ??
Or have we lost the plot
Regards,
Actually, if you use GET the values will be in the $_GET-array.
Use a script like this
and assign the values you need to the mail-function .
BUT: using $_GET, especially in this instance where you post emails using GET, is a HUGE security-risk. Everyone could use your script to mass-mail whatever they wanted to.
Try using $_POST - which is somewhat safer (but far from 100%).
Use a script like this
Code: Select all
<?php
foreach($_GET as $key=>$value)
echo "<br>$key = $value";
?>BUT: using $_GET, especially in this instance where you post emails using GET, is a HUGE security-risk. Everyone could use your script to mass-mail whatever they wanted to.
Try using $_POST - which is somewhat safer (but far from 100%).
-
polosport6699
- Forum Commoner
- Posts: 35
- Joined: Wed Jun 11, 2003 3:19 pm
Hmmm
What would be the code, to go from php form values saying there defined as $value1 $value2 and so on, to emailing thoes values in a clickable link in an auto email
You just need to concatinate (glue together) the bits of the $_GET array into a qualified URL:
As dummy data:
Would produce:
http://www.devnetwork.net/index.php?x=H ... UM&z=USERS
As a string in the $url variable, you then need to write this into your message body, as part of the mail() method.
Regards,
Code: Select all
$url = "http://".$_GET['DOMAIN']."/".$_GET['FILE']."?x=".$_GET['VAR_X']."&y=".$_GET['VAR_Y']."&z=".$_GET['VAR_Z'];Code: Select all
$_GET['DOMAIN'] = "www.devnetwork.net";
$_GET['FILE'] = "index.php";
$_GET['VAR_X'] = "HELLO";
$_GET['VAR_Y'] = "FORUM";
$_GET['VAR_Z'] = "USERS;http://www.devnetwork.net/index.php?x=H ... UM&z=USERS
As a string in the $url variable, you then need to write this into your message body, as part of the mail() method.
Regards,