/    Sign up×
Community /Pin to ProfileBookmark

Need help with PHP

All:

Any and all help is appreciated. I am currently trying to solve the following problem. I currently use the following info:

First page:
<form name=”form1″ method=”post” action=”XXX.asp”>
<select name=”ABC” id=”ABC”>
<option value=”a”>a</option>
<option value=”b”>b</option>
<option value=”c”>c</option>
<option value=”d”>d</option>
</select>
<input type=”submit” name=”Submit” value=”Go”>
</form>

Second page: (XXX.asp)

This is the good part that works:
<a href=”http://www.example.net/click-123-456?SID=<?php print $_POST[‘ABC’]; ?>” target=”_blank”>DEF </a>

My problem is that I need to replicate the above link in a different part of my page. However, this additional link must have a different value. For example, if a user selects “a”, then I need to create two links on the XXX.asp page, one with value “a” and one with value “1”. And so on for the other options.

I just do not know how to create the second variable in my form, as I assume I would be able to use POST or GET once I have that value created.

Thanks!

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@JupacSep 19.2004 — why is it .asp ???
Copy linkTweet thisAlerts:
@JonaSep 19.2004 — [font=trebuchet ms]Set the values of the OPTIONS to parsable strings with multiple values, or create an array to read from.[/font]
Copy linkTweet thisAlerts:
@dave36authorSep 19.2004 — sorry...it is php...the form was copied from my original asp page (i migrated to php)...nice catch
Copy linkTweet thisAlerts:
@dave36authorSep 19.2004 — Jona:

How do i do that?
Copy linkTweet thisAlerts:
@JonaSep 20.2004 — <i>
</i>&lt;!-- HTML form --&gt;
&lt;select size="1" name="ABC"&gt;
&lt;option value="a|1"&gt;A&lt;/option&gt;
&lt;option value="b|2"&gt;B&lt;/option&gt;
&lt;option value="c|3"&gt;C&lt;/option&gt;
&lt;/select&gt;


[code=php]
# Your PHP file.

# Remove HTML-characters and strip any extra slashes
$abc = htmlspecialchars(stripslashes($_POST["abc"]));

# Split it by the pipe delimiter to get the seperate values
$abc = explode("|", $abc);

# Print the pairs.
echo "{$abc[0]} = {$abc[1]}n";
[/code]
×

Success!

Help @dave36 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.17,
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,
)...