Thorned Rose
Apr 8 2007, 12:58 AM
| | 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! |
Reply
jlhaslip
Apr 8 2007, 01:56 AM
*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.
Reply
Thorned Rose
Apr 8 2007, 02:14 AM
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.
Reply
jlhaslip
Apr 8 2007, 02:22 AM
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.
Reply
Thorned Rose
Apr 8 2007, 09:11 PM
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!
Reply
jlhaslip
Apr 8 2007, 09:26 PM
And I'm not even a Hobbit... glad it worked.
Reply
Similar Topics
Keywords : php variables url tear- Counting Variables?
- (4)
- Transfer Variables To Another Php Script
- (8)
Hello, I've one registration page where the users fills in their information, is it possible to
trasnfer the things the fill in on the registration page to another script that does someting and
returnes something to the first page like true/false and then the registration gives an error
messange if the other php script returned false? Something like the script "activates" another
script that does something and returnes the result back to the original script. Best Regards ...
Php Sessions And Post Variables Issues
- My script dosent seem to work as intended (1)
You can test it out for yourself at http://sonesay.trap17.com/application.php I've been
working on this page locally and it seems to be working fine but when I upload it to my trap17
account the post variables dont get saved properly. Fill in some fields and submit it, the form
will come up as a empty field yet when you resubmit it without any modifications and the data you
entered in orginally will now magically appear, resubmit it again and it will be gone. This is
really annoying as I have no clue why it would be doing this when it seems to work fine locally....
Sending $_get[] Variables To An Application
- (3)
I'm trying to work out if it is possible to send variables to a application on server. E.g
send the variable of id which is equal to 10 to an application - test.exe?id=10 Any ideas to see if
this is possible?...
Storing Session Variables Generated Dynamically
- (3)
i have many pool (quiz) modules on my site with the information taken from a database. The modules
are processed by the same function with different parameters and i need to save the pool's
status to prevent a user vote several times. I do this setting $_SESSION to 1 , variable
being the name of the quiz, which is taken from the database. So i get to having a code like this:
.................... $name= $row->quiz_name; $_SESSION =1 The problem is that if
i call $_SESSION from another part of the site (another page) the variable is al...
Session Variables
- Sessions in PHP behaving strangely (4)
Hi. I am part of a development team working in PHP and MySQL. The site is using SSL, and users
have to log to use the site. When users log in, their important details are retrieved from the
database and stored in session variables (functionality in the site is permissions specific).
Lately, sessions are "disappearing" for no apparent reason. Users will log in, and at some point
(the length of time will vary unpredicatably) the sessions will lose their value (the variables are
empty) and this causes the site to evict the user. This is very frustrating for the user b...
Converting Characters In A Variable To Individual Values In An Array
- turning variables into arrays (2)
Say I have a variable such as $nav_item and it had to contents Home . IE: CODE
$nav_item = 'Home'; How would I make so that $nav_item was an array and
had the following contents? CODE $nav_item = array ('h', 'o',
'm', 'e'); With the case changing (ie H would become h and U
would become u ) EDIT: Okay found out that I could change the case with
array_change_key_case ($nav_item, CASE_LOWER); ...
How Long Do $_post Variables Stay Stored?
- (6)
let's say that for whatever reason, let's say for a survey, i want to make a quiz like
w3schools.com has, only with PHP. i would want to put all the questions on different pages, also
like w3schools. could each of the submissions stay stored inside PHP's $_POST for 20
pages? if not, how could i get around it? PS. i really don't know anything about ASP other than
the fact that w3schools uses it. so please don't explain to me with ASP-specific terms......
Looking for pass, php, variables, url, form, im, read, tear, hair
|
|
Searching Video's for pass, php, variables, url, form, im, read, tear, hair
|
advertisement
|
|