smatt454 Posted May 13, 2009 Share Posted May 13, 2009 Hello. I have a question I believe should be fairly straight forward. Here's a little of my code, I believe seeing it first should help make my question more understandable. $vendor[$x] = $_COOKIE["vendor$x"]; if ($vendor[$x] == "") $vendor[$x] = "Vendor name:\nAddress:\nCity:\nState:\nZip:"; <form name="request" action="./request.php" method="POST"> <textarea name="vendor'.$x.'" rows="4" cols="30">'.$vendor[$x].'</textarea> <input type="submit" name="submit" value="Submit"> </form> So basically, in request.php I want to split the $_POST value of vendor. I want to look for the \n, and separate the values into Name, Address, City, State, and Zip. I've never had to split cookies in an application, so any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Dathremar Posted May 13, 2009 Share Posted May 13, 2009 Try using the explode php function http://www.php.net/manual/en/function.explode.php That's how You can split the variable into array and they use them as u like Hope it helps Quote Link to comment Share on other sites More sharing options...
smatt454 Posted May 13, 2009 Author Share Posted May 13, 2009 Well I tried this $vendor[$x] = $_POST["vendor$x"]; $vendorsplit = explode ("\n",$vendor[1]); setcookie("vendorname$x",$vendorplit[0]); Just to clear it up, there is obviously a loop in both of these instances, but for simplicity sake I just tried to explode the first varriable. Please note that I am currently getting the value of $_POST["vendor$x"] and putting it into a cookie called vendor$x. In the above code, the program does run through the loop, and gets the POST values correctly. However, when I try exploding vendor[1] (which contains the name, address, etc of the first vendor) and then setting the cookie vendorname$x as the first value in the array, the cookie is not set. Any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.