|
|
|
|
![]() ![]() |
Apr 8 2007, 12:58 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 223 Joined: 16-January 06 From: New Zealand Member No.: 17,178 |
Ok, what I need is for users to be able to select what address they want (e.g. mydomain + .com), click submit that then sends the variables 'domain' and 'ext' through the URL e.g. mywebsite.com/example.php?domain=mydomain&ext=com (the variables being mydomain and com) where they are displayed in a form mail as "Domain Selected: mydomain.com" that can then be submitted and sent to an email.
In my form so far I have CODE <input name="domainname" type="text" id="domainname" value ="<?php echo "$domain"; ?>"> but it don't do poo and I'm sure that anyone in the know is laughing at my sad attempt at PHP but if you could please tell me how I call both variables from the URL so that they display in the form as one whole address (i.e. mydomain.com not my domain and com) that would be very much appreciated! |
|
|
|
Apr 8 2007, 01:56 AM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
*edit*
What you have there uses the $domain variable. In order to grab the values from the URL, use the $_GET array. CODE <input name="domainname" type="text" id="domainname" value ="<?php echo $_GET['domain']; ?>"> <input name="extensionname" type="text" id="extensionname" value ="<?php echo $_GET['ext']; ?>"> Withput seeing the entire code you are using, this is my best guess. If this doesn't work for you, please re-post with the entire code. Well, at least the Form in question and the receiving script. Thanks. |
|
|
|
Apr 8 2007, 02:14 AM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 223 Joined: 16-January 06 From: New Zealand Member No.: 17,178 |
I can't give you the form for the part that generates the URL as that is a component for Joomla!, just that it outputs the variables in a url that looks like mywebsite.com/example.php?domain=mydomain&ext=com
Here's a simple form (sorry it's messy) with how I want to output the variables domain and ext CODE <form action="process.php" method="post"> <input type=hidden name="subject" value="Domain Request"> <div align="center">Name: <input type="text" name="name" size="30" maxlength="30" /> <br /> <br /> Email: <input type="text" name="email" size="30" maxlength="30" /> <br /> <br /> Domain: <input name="domainname" type="text" id="domainname" value ="<?php echo "$domain" "$ext"; ?>"> <br /> <br /> <input type="submit" name="submit" value="Send" /> </div> </form> This form should display the variables in a text box as "mydomain.com". People can then finish putting in their name and email and hit send which should then send all the form info to an email address. My process.php so far looks like this: CODE <?php @extract($_POST); $name = stripslashes($name); $email = stripslashes($email); $subject = stripslashes($subject); $domainname = stripslashes($domainname); mail('email@address.com',$subject,$domainname,"From: $name <$email>"); header("location:form.php"); ?> It's displaying the variables from the url within the form that have me stumped so far. |
|
|
|
Apr 8 2007, 02:22 AM
Post
#4
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
This is going to get a bit confusing because Joomla is using the $_GET Superarray and you are using the $_POST Superarray, so adjust the $_GET's and $_POST's accordingly. Your form shows the method=POST, so you will need to use the $_POST array to display your data, but Joomla is using the $_GET array(method) and that will require using the $_GET values for where you receive their data.
When the variables are physically included in the URL, use the $_GET array. *edit* CODE <?php echo $domain . '.' . $ext; ?> to add the 'dot' in the output.
|
|
|
|
Apr 8 2007, 09:11 PM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 223 Joined: 16-January 06 From: New Zealand Member No.: 17,178 |
Wohoo! I got it. I combined the two things you said jlhaslip to get:
CODE <input name="domainname" type="text" id="domainname" value ="<?php echo $_GET['domain']. '.' . $_GET['ext']; ?>"> And it works perfectly. Thanks for all your help dude! You are a legend as always! |
|
|
|
Apr 8 2007, 09:26 PM
Post
#6
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
And I'm not even a Hobbit... glad it worked.
|
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 25th July 2008 - 09:02 PM |