/    Sign up×
Community /Pin to ProfileBookmark

Email box link filler

Hello,
Im trying to setup a page of my site with sponsor links. Heres my goal:
At the top of the page, there is a text box asking for person’s email address. then a OK button. Below are like 10 images hyperlinked. I want to make it so they have to put in their email and hit OK for the hyperlinks to enable, if they dont, the linked images cant be clicked.
Then also, the hyperlinks at the end have uid=xxxx where I want to make the xxxx for every link their email address that thye entered in earlier. This way I can track who signed up for what and what they did. the link is like [url]http://www.adthingy.com/blahblahd&whatever&uid=[/url][email]

Hopefully you follow. Please help me make a page like this

thank you very much in advance,
Jason

to post a comment
PHP

19 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 25.2005 — Sorry, but I can't in good conscience help someone make a page that requires the user to input their email address for no apparent purpose other than to collect it for spamming. Apologies if that's not your intent, but I find it hard to assume otherwise with the limited info provided.
Copy linkTweet thisAlerts:
@jason8612authorJan 25.2005 — No, thats not my goal at all.

The site for the offers, Searchcactus.com allows me to track the links click by the unique id (uid). That way i can credit their account right, and in case someone forgets to let me know, they can still get the points.

Im not in any way using it for spam or anything. they already signed up, just a easy way to track the completed links.
Copy linkTweet thisAlerts:
@NogDogJan 25.2005 — OK, you talked me into it (or I couldn't resist the challenge?). ?
[code=php]
<?php
function add_href($href)
{
if(isset($_POST['email'])
{
return(" href=http://$href?".urlencode("email={$_POST['email'])));
}
return("");
}
?>

<form name=email method=post action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>Email: <input name=email type=text size=20 maxlength=40>
<input name=submit type=submit value="Submit"></p>
</form>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis <a<?php echo(add_href("www.test.com/page.html")); ?>>nostrud exercitation</a>
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum</p>
[/code]
Copy linkTweet thisAlerts:
@jason8612authorJan 25.2005 — Tried it.

I get a error on line 5.

Line 5 is the "{" right after the "if(isset($_POST['email']) "

Parse error: parse error, unexpected '{' in /home/jksoluti/public_html/test1.php on line 5
Copy linkTweet thisAlerts:
@NogDogJan 25.2005 — [i]Originally posted by jason8612 [/i]

[B]Tried it.

I get a error on line 5.

Line 5 is the "{" right after the "if(isset($_POST['email']) "



Parse error: parse error, unexpected '{' in /home/jksoluti/public_html/test1.php on line 5 [/B]
[/QUOTE]

Other than the fact that I typed a ')' instead of a '}' and I forgot a closing quote, it was fine. :rolleyes:
[code=php]
return(" href=http://$href?".urlencode("email={$_POST['email']}"));
[/code]
Copy linkTweet thisAlerts:
@jason8612authorJan 25.2005 — Parse error: parse error, unexpected T_RETURN in /home/jksoluti/public_html/test1.php on line 6


?
Copy linkTweet thisAlerts:
@NogDogJan 25.2005 — I tested this and it parsed OK (and even worked). As usual, it was just an unbalanced parenthesis.
[code=php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
<title>Untitled</title>
<style type="text/css">
</style>
</head>
<body>

<?php
function add_href($href)
{
if(isset($_POST['email']))
{
return(" href=http://$href?".urlencode("email={$_POST['email']}"));
}
return("");
}
?>

<h1>Lorem Ipsum</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. <a<?php echo(add_href("www.test.com/test.html")); ?>>Duis aute</a>
irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum</p>

</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@jason8612authorJan 26.2005 — hahaha

Ill try it out tonight

Thanks a lot, I appreciate it.
Copy linkTweet thisAlerts:
@jason8612authorJan 26.2005 — only thing i noticed when i put the @, it changes it to the % in the link...
Copy linkTweet thisAlerts:
@NogDogJan 26.2005 — [i]Originally posted by jason8612 [/i]

[B]only thing i noticed when i put the @, it changes it to the % in the link... [/B][/QUOTE]

Yep, '@' is not a valid URL character, so urlencode() changes it to its octal value (or is it hexadecimal - I don't recall off the top of my head), preceded by a '%' to indicate this.

If you need to reverse this in a subsequent PHP page, use [url=http://us4.php.net/manual/en/function.urldecode.php]urldecode()[/url] to convert it back.
Copy linkTweet thisAlerts:
@jason8612authorJan 27.2005 — It works perfectly!

A few modifications though.... ?

How can I make it so after the person hits "Submit" that submit box either vanishes or is disabled and whatever was typed in the box is left there, but the box is grayed out - they cant change the info unless they reload the page?


--Jaosn
Copy linkTweet thisAlerts:
@NogDogJan 27.2005 — [i]Originally posted by jason8612 [/i]

[B]It works perfectly!

A few modifications though.... ?



How can I make it so after the person hits "Submit" that submit box either vanishes or is disabled and whatever was typed in the box is left there, but the box is grayed out - they cant change the info unless they reload the page?





--Jaosn [/B]
[/QUOTE]

[code=php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
<title>Untitled</title>
<head>
<style type="text/css">
.fakebox {
background-color: silver;
color: black;
margin: 0;
padding: 0 4px;
border-style: inset;
border-width: thin;
}
</style>
</head>
<?php
function add_href($href)
{
if(isset($_POST['email']))
{
return(" href=http://$href?".urlencode("email={$_POST['email']}"));
}
return("");
}

if(isset($_POST['email']))
{
echo "Email: <span class=fakebox>{$_POST['email']}</span>n";
}
else
{
echo <<<EOD
<form name=email method=post action="{$_SERVER['PHP_SELF']}">
<p>Email: <input name=email type=text size=20 maxlength=40>
<input name=submit type=submit value="Submit"></p>
</form>
EOD;

}
?>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis <a<?php echo(add_href("www.test.com/page.html")); ?>>nostrud exercitation</a>
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum</p>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@jason8612authorJan 27.2005 — cool,

Ill try that today and let you know.
Copy linkTweet thisAlerts:
@jason8612authorJan 27.2005 — get a phase error on the echo <<<EOD

after the else.
Copy linkTweet thisAlerts:
@NogDogJan 27.2005 — [i]Originally posted by jason8612 [/i]

[B]get a phase error on the echo <<<EOD

after the else. [/B]
[/QUOTE]

Make sure the [FONT=courier new][B]EOD;[/B][/FONT] has no leading [b]or[/b] trailing white space. (That's my best guess, anyway. It worked for me on my server. But if you cut-and-pasted the code it might have stuck in a trailing space character, or you might have indented it or something?)
Copy linkTweet thisAlerts:
@jason8612authorJan 27.2005 — hmmmm

Parse error: parse error, unexpected $ in /home/jksoluti/public_html/sponsors2.php on line 667


line 667 is </html>
Copy linkTweet thisAlerts:
@NogDogJan 27.2005 — [i]Originally posted by jason8612 [/i]

[B]hmmmm

Parse error: parse error, unexpected $ in /home/jksoluti/public_html/sponsors2.php on line 667





line 667 is </html> [/B]
[/QUOTE]

Missing a closing '?>', perhaps? (Using a syntax color-highlighting editor like [url=http://www.chami.com/html-kit/]HTML-Kit[/url] helps in finding such things.)
Copy linkTweet thisAlerts:
@jason8612authorJan 28.2005 — hmm checked, not missing any ?>
×

Success!

Help @jason8612 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...