-3

I Want to open new window, And send to php file POST value.

Like

<a href = 'URL.php' target = '_blank'> Tish is link </a>

How to send POST value?

Edit : I already try this

<form target='_blank' method='POST' action='code.php'>
<input type = 'hidden' name='function_code' value='$code'>
<button id='submit_button' type = 'submit' value='$code'>$code</button>
</form>

But target=_blank opened new tab, not a pop-up(new window) I want to open 'New window & pop-up', Send Post value When i click button.

Solved like this

<form action='#' method='post' name='fdata' id='fdata'>
<input type='hidden' name='code' value='$code'>
<input type='button' name='btn' value='$code' onclick='window_open();'>
</form>

function window_open()
{
    window.open("about:blank","window_name","width=640,height=480,scrollbars=yes");
    document.fdata.target = "window_name";
    document.fdata.method = "post";
    document.fdata.action = "code.php";
    document.fdata.submit();
}

Thank you so much!

user3273401
  • 35
  • 1
  • 10
  • this is not a tutorial site. Go and try to understand what POST is. (just google POST php) Then try to achieve your goal. If you come across a problem which you can not solve, ask your spesific problem here. – epipav Jul 25 '14 at 08:00
  • this is not a tutorial website as @epipav said ..:p – Avinash Babu Jul 25 '14 at 08:16
  • I am truly sorry for my misbehavior. I understand What Post is(I think)...But Don't Know Why do not working . (And I was able in Javascript What i want) Sorry. @epipav – user3273401 Jul 25 '14 at 08:30

1 Answers1

-2

This is natively not possible.

You can however cheat a little and create a form to submit your data from there. It might be the easiest to use a button to submit the form, and restyle it to look like a link (see this question).

<form action="#" method="post" target="_blank">
    <input type="hidden" name="name" value="user3273401">
    <input type="hidden" name="text" value="I wanna do this!">
    <button type="submit" value="Tish is link">Tish is link</button>
</form>

This will send the data to a new tab with the POST method.

padarom
  • 3,529
  • 5
  • 33
  • 57
  • I alredy try form tag, but open 'new tab'
    . I want to pop-up new window
    – user3273401 Jul 25 '14 at 08:08
  • Does [this](https://stackoverflow.com/questions/2541392/opening-new-window-in-html-for-target-blank) help you? – padarom Jul 25 '14 at 08:13
  • thankyou so much! Problem solved! function window_open(){ window.open("about:blank","window_name","width=640,height=480,scrollbars=yes"); document.fdata.target = "window_name"; document.fdata.method = "post"; document.fdata.action = "code.php"; document.fdata.submit(); } And
    – user3273401 Jul 25 '14 at 08:22