Hey Gurus,
I got a problem but I think im being dum about it. I want to send a custome message in the url to the next page E.G
process.php?jid=$job_id&jib=$createuser_id&tit=$title&cost=$cost&custom=$custom
The custom variable i need it to be a text box where a user can enter a sentence. The only way i know how to do this is a form i just want to know isit possible to send the message in the URL. Its the admin side of the site so it doesnt matter if the url is untidy.
Any help much appreciated.
Text variable in url string
Moderator: General Moderators
Re: Text variable in url string
Yeah, it's possible. Anything in the URL can be accessed with $_GET.
Remember to urlencode whatever message you use.
Remember to urlencode whatever message you use.
Re: Text variable in url string
Ok now I know its possible how would I do it.
Normally i would just do $custom = "text here..."; but as it really has to be custom i dont know how it would work with a text box.
I thoguht it would be something like $custom = "<input name="custom" type="text" maxlength="60" value="text here">";
That doesn't look right to me, any suggestions on how i can input data to custom
Normally i would just do $custom = "text here..."; but as it really has to be custom i dont know how it would work with a text box.
I thoguht it would be something like $custom = "<input name="custom" type="text" maxlength="60" value="text here">";
That doesn't look right to me, any suggestions on how i can input data to custom
Re: Text variable in url string
You don't have to use a form. A link is enough.
Code: Select all
$job_id = 123;
$createuser_id = 456;
$title = htmlentities(urlencode("Some title"));
$cost = 7.89;
$custom = htmlentities(urlencode("Custom message"));
echo "<a href='process.php?jid=$job_id&jib=$createuser_id&tit=$title&cost=$cost&custom=$custom'>Link</a>";Re: Text variable in url string
The user needs to be able to create the custom message, which is why i thought text box. Sorry if that wasn't clear 
Re: Text variable in url string
Then yes, use a form. Set the form method=get and pretend it's a posted form.
The textbox will start with $custom but the user can change it if they want.
Code: Select all
<form action="process.php" method="get">
<input type="hidden" name="jid" value="$job_id">
<input type="hidden" name="jib" value="$createuser_id">
<input type="hidden" name="tit" value="$title">
<input type="hidden" name="cost" value="$cost">
<input type="text" name="custom" value="$custom">
<input type="submit" value="Submit">
</form>Re: Text variable in url string
Thanks you tasairis! 