/    Sign up×
Community /Pin to ProfileBookmark

PHP/HTML Form Help….

I am trying to embed the value of one field into a link placed in another field within the same table.

Any help would be GREATLY appreciated.

[CODE]
[COLOR=”red”]process.php[/COLOR] (the form processing code)

<?php
$UserID=$_POST[‘UserID’];
$Link=$_POST[‘Link’];
$UserNumber=$_Post[‘UserNumber’];

mysql_connect(“[COLOR=”Red”]localhost[/COLOR]”, “[COLOR=”red”]username[/COLOR]”, “[COLOR=”red”]password[/COLOR]”) or die(mysql_error());
mysql_select_db(“[COLOR=”red”]databasename[/COLOR]”) or die(mysql_error());
mysql_query(“INSERT INTO [COLOR=”red”]tablename[/COLOR] (serID, Link, UserNumber)
VALUES (‘$UserID’, ‘$Link’, ‘$UserNumber’)”);

Print “Your information has been successfully added to the database.”;

?>

[/CODE]

[CODE]
[COLOR=”Red”]index.php[/COLOR] (form code)

<FORM ACTION=”[COLOR=”red”]process.php[/COLOR]” method=”post”>
Your User Name: <INPUT TYPE=TEXT NAME=”UserID” SIZE=20>

<INPUT TYPE=HIDDEN VALUE=”<a href=[COLOR=”red”]’http://link[/COLOR]=[COLOR=”Lime”]$FriendID[/COLOR]’ target=’_blank’></a>” NAME=”Link” SIZE=250>

<INPUT TYPE=HIDDEN VALUE=”1 ++” NAME=”UserNumber” SIZE=20>

<INPUT TYPE=SUBMIT NAME=”SUBMIT” VALUE=”Submit”>

</FORM>

[/CODE]

[COLOR=”lime”]What I think the problem is[/COLOR]
[COLOR=”Red”]Edited for security[/COLOR]

I just need help embedding the User ID into the link that is stored in the “Link” Field. Thanks in advance! Derek.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@StudioMeshauthorJun 21.2009 — Okay, I have looked at MANY MANY tutorials, sites, and forums. I have came up with another idea to attempt this. However, it does not work either.

I created a new test table, with three fields (link1, UserID, link2).

I used link one to store the first part of the URL up to the point where I need to insert the UserID. I used the UsedID field obviously for the UserID. And I used the link2 field for the remaining portion of the URL.

link1 and UserID fields both worked fine! But the link2 field kept generating blank data. I am assuming this is because it starts with an apostrophe. I have checked the coding MULTIPLE times and everything is correct.

My question now is, if I can get this to work is it possible to fetch the data from these three fields and place them into a table cell with no extra spaces so that it becomes 1 entire link again?
Copy linkTweet thisAlerts:
@StudioMeshauthorJun 23.2009 — ? No one has any suggestions?
Copy linkTweet thisAlerts:
@kurbyJun 23.2009 — Print out the query before you run it. Its probably an issue with your single quotes. You are going to need to escape them if you want to insert them into the DB. A print out of the query will let us see how they are matching up.
×

Success!

Help @StudioMesh 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.18,
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,
)...