Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: php post data

(174 views • 10 replies)

This topic is 1 page long.

<< < > >>
None

Snubby

Reply To Post Reply & Quote

Posted at: 11/24/07 11:53 AM

Snubby FAB LEVEL 20

Sign-Up: 12/04/04

Posts: 3,141

is it possible to send post data through just a text link? I know how to send it using a form, but I want just a regular link to send post data. if this requires more than jsut html, can i do it using php?

any help?


None

SpamBurger

Reply To Post Reply & Quote

Posted at: 11/24/07 12:10 PM

SpamBurger NEUTRAL LEVEL 15

Sign-Up: 07/12/05

Posts: 4,560

Just make a link that does something like this:

<a href="javascript:void(document.form_name.submit())">Submit Form</a>

Whatever happened to Mr. Shoot by DarkToaster?

BBS Signature

None

scott300

Reply To Post Reply & Quote

Posted at: 11/24/07 12:40 PM

scott300 EVIL LEVEL 13

Sign-Up: 03/25/05

Posts: 43

You need to use GET

so the link index.php?id=1
$id=$_GET['id'];

so than $id would be 1


None

atomic-noodle

Reply To Post Reply & Quote

Posted at: 11/24/07 12:50 PM

atomic-noodle LIGHT LEVEL 13

Sign-Up: 05/17/05

Posts: 1,524

At 11/24/07 12:40 PM, scott300 wrote: You need to use GET

so the link index.php?id=1
$id=$_GET['id'];

so than $id would be 1

He asked how to send via POST not GET...


None

SpamBurger

Reply To Post Reply & Quote

Posted at: 11/24/07 01:09 PM

SpamBurger NEUTRAL LEVEL 15

Sign-Up: 07/12/05

Posts: 4,560

Also, if what I gave you isn't what you wanted, you could also use Ajax.

Whatever happened to Mr. Shoot by DarkToaster?

BBS Signature

None

Snubby

Reply To Post Reply & Quote

Posted at: 11/24/07 01:36 PM

Snubby FAB LEVEL 20

Sign-Up: 12/04/04

Posts: 3,141

how do i specify what data to send though? i tried that and it worked, but it didn't send any data. i tried writing get data in the action of the form, but of course that just did get data


None

different

Reply To Post Reply & Quote

Posted at: 11/24/07 01:40 PM

different DARK LEVEL 34

Sign-Up: 07/08/04

Posts: 3,766

Why do you need a text link to submit a form? This is what buttons are for. Links are for navigation, buttons are for action.

simple & minimal, that's my style.
thoughts on ux, usability & design


None

SpamBurger

Reply To Post Reply & Quote

Posted at: 11/24/07 01:42 PM

SpamBurger NEUTRAL LEVEL 15

Sign-Up: 07/12/05

Posts: 4,560

Set you your form like this:

<form action="somepage.php" method="post" name="myform">
<input type="hidden" value="somedata" name="somename">
</form>

and then make your link like this:

<a href="javascript:void(document.myform.submit())">Send post data</a>

Whatever happened to Mr. Shoot by DarkToaster?

BBS Signature

None

Snubby

Reply To Post Reply & Quote

Posted at: 11/24/07 05:12 PM

Snubby FAB LEVEL 20

Sign-Up: 12/04/04

Posts: 3,141

Thanks SpamBurger, it works perfectly.

At 11/24/07 01:40 PM, different wrote: Why do you need a text link to submit a form? This is what buttons are for. Links are for navigation, buttons are for action.

I want some secret pages of my website that include like, secret cartoons and shit, just like an easter egg hunt. but i dont want people to be able to just link to them, with the post data they actually have to get there.


None

different

Reply To Post Reply & Quote

Posted at: 11/24/07 05:55 PM

different DARK LEVEL 34

Sign-Up: 07/08/04

Posts: 3,766

I see. That should be fine. :-)

You might want to add the link using javascript too, so that people don't see it in the source code.

simple & minimal, that's my style.
thoughts on ux, usability & design


None

Snubby

Reply To Post Reply & Quote

Posted at: 11/24/07 06:49 PM

Snubby FAB LEVEL 20

Sign-Up: 12/04/04

Posts: 3,141

At 11/24/07 05:55 PM, different wrote: I see. That should be fine. :-)

You might want to add the link using javascript too, so that people don't see it in the source code.

eh, this should be fine.

thanks for the help, guys.


All times are Eastern Daylight Time (GMT -4) | Current Time: 03:28 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!