hello everyone..I am trying to pass some php variables from a form on one of my sites into a URL..although I am having trouble..my form is using post method and the action I am using is to another php file..for example, the script is on bluewidget.com/site1.php my action is going to site2.php (same location) so I should be hitting a URL like bluewidget.com/site1.php?action=site2.php&name=NameHere&email=EmailHere&submit=Submit this should be correct right? Any thoughts or suggestions to a php newb
If you're going to use variables in the url, you'll need to use method=GET on your form. POST method will not append vars onto URL. To parse the form, you'd use predifined variables $_GET['yourvarname'] List of all predefined php vars is at http://us3.php.net/manual/en/reserved.variables.php
If you're using Post in your form variables in the URL won't work. Post and Get are different. Ex: <form action="script.php" method="post"> Name: <input type="text" name="name" /> Address: <input type="text" name="address" /> Phone: Name: <input type="text" name="phone" /> </form> Code (markup): Then your script will need to be <?php $name = $_POST['name']; $address = $_POST['address']; $phone = $_POST['phone']; ?> Code (markup): If it's <form action="script.php" method="get"> Name: <input type="text" name="name" /> Address: <input type="text" name="address" /> Phone: Name: <input type="text" name="phone" /> </form> <?php $name = $_GET['name']; $address = $_GET['address']; $phone = $_GET['phone']; ?> Code (markup): If you don't care because people could be sending their forms via Post or Get <?php $name = $_REQUEST['name']; $address = $_REQUEST['address']; $phone = $_REQUEST['phone']; ?> Code (markup): Hope that helps. Mike
you just use hidden inputes of HTML review this ------------ step1.php <form method="post" action="step2.php"> <input type="hidden" name="variablename" values="<?=$phpvarible?>"> </form> ------------- ------------- step2.php u can get the values from $_POST['variblename']; -------------