PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i want to get a user to fill out an html text form and then use that variable to open up a new tab and take them to a google books search page of the title they entered.
however there is a problem with this code because it only displays the contents of the page i direct it to. this means that the user cannot click any links on the page that is displayed. how can i correct this problem?
EDIT: i can also use window.open but i would really prefer if it would just open a new tab
but if i use this way then how will i pass my book title variable into the url that i want to open? because the url that i want to open is dynamic dependent on the input they type in
Expanding on the idea presented by flying_circus a bit:
You could change your form target to a page that you create. Maybe like openlink.php. Set your form target to _blank like flying_circus presented. Then with your form data comes in, do your str_replace like you are doing now. Build your URL string, save it in a variable, then issue a header redirect to kick the user to where you want them to go.
I haven't tested this, but in theory openlink.php should open in a new tab, do it's form processing and kick the user on. Might be worth a shot.
nowaydown1 wrote:Expanding on the idea presented by flying_circus a bit:
You could change your form target to a page that you create. Maybe like openlink.php. Set your form target to _blank like flying_circus presented. Then with your form data comes in, do your str_replace like you are doing now. Build your URL string, save it in a variable, then issue a header redirect to kick the user to where you want them to go.
I haven't tested this, but in theory openlink.php should open in a new tab, do it's form processing and kick the user on. Might be worth a shot.
Sure, that should work, you're just creating a forwarder.
nowaydown1 wrote:Expanding on the idea presented by flying_circus a bit:
You could change your form target to a page that you create. Maybe like openlink.php. Set your form target to _blank like flying_circus presented. Then with your form data comes in, do your str_replace like you are doing now. Build your URL string, save it in a variable, then issue a header redirect to kick the user to where you want them to go.
I haven't tested this, but in theory openlink.php should open in a new tab, do it's form processing and kick the user on. Might be worth a shot.