...

View Full Version : Alternative to $_get



GenVic
08-25-2009, 05:09 PM
I need to pass and display some variables , but some will be longer than 100 characters, what alternative to $_GET can I use?

Phil Jackson
08-25-2009, 05:25 PM
$_post

GenVic
08-25-2009, 05:36 PM
Hmm, I think my problems go beyond that. Clearly, I can see my what I need passed in the url, but it's not showing on the page when I try echoing out.

seco
08-25-2009, 05:39 PM
you need to show us what is posting the var and how your echoing the var if you want help.

GenVic
08-25-2009, 06:04 PM
Page1.php

<form method="post" action="sendmail.php">
<input type="text" name="email"/><br />
<input type="hidden" name="product" value="<?php echo $row_product['product']; ?>"/>

<input type="submit" />
</form>

sendmail.php

$email = $_REQUEST['email'] ;
$product=$_REQUEST['product'];
$recipients = "test@gmail.com";

$message="
Request From: $email
Interested In: $product

";

mail( "$recipients", "$email Needs ", $message , "From: $email " );

header("location:results.php?email=$email&product=$product");





results.php page

<?php echo $_GET['product']; ?>

Plus this page has a lot of other garbage such as parts of an xcart script etc...




Everything works fine up until the last page where I see the 'product' variable in the URL but it doesn't echo out. It is a fairly long url, don't know if that's the issue.

tailender1
08-25-2009, 06:46 PM
there are other variables you can use alternative to $_GET
$_POST
$_COOKIE (can be set only once per page)
$_SESSION

seco
08-25-2009, 06:49 PM
Those requests need to be posts.


$email = $_POST['email'] ;
$product=$_POST['product'];
$recipients = "test@gmail.com";

$message="
Request From: $email
Interested In: $product

";

mail( "$recipients", "$email Needs ", $message , "From: $email " );

header("location:results.php?email=$email&product=$product");

whizard
08-25-2009, 06:52 PM
Those requests need to be posts.

In case you're (GenVic) confused as to why, its because the form is using the post method:

<form method="post">

Dan

GenVic
08-25-2009, 07:30 PM
Thanks guys, that did it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum