Mirek Posted September 4, 2006 Share Posted September 4, 2006 Hi there,I am trying to create a form which gets added to a page via an include file but can not work out how to insert ' php $_SERVER['PHP_SELF']; ' in it so when it gets loaded from the variable it actually works.I have tried many different ways and its got me kind of beat as it either comes back with just useless text or a php error.current code[code] $a_status = '<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" name="form1" id="form1"> ' ;[/code]thx in advance. Quote Link to comment https://forums.phpfreaks.com/topic/19621-embedding-php/ Share on other sites More sharing options...
onlyican Posted September 4, 2006 Share Posted September 4, 2006 PHP_SELF is the same pageI dont understand what you are asking? Quote Link to comment https://forums.phpfreaks.com/topic/19621-embedding-php/#findComment-85442 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Use this:[code=php:0]$a_status = '<form action="' . $_SERVER['PHP_SELF']; . '" method="post" name="form1" id="form1"> ';[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19621-embedding-php/#findComment-85445 Share on other sites More sharing options...
onlyican Posted September 4, 2006 Share Posted September 4, 2006 to include another page, u would use<?php include("file.php");?>orrequireinclude_oncerequire_once Quote Link to comment https://forums.phpfreaks.com/topic/19621-embedding-php/#findComment-85449 Share on other sites More sharing options...
Mirek Posted September 4, 2006 Author Share Posted September 4, 2006 Ahh excelent Wildteen, thxThat did the trick except for the ';' .I am sure I would have tried that but yeah thats coding.----------------------------------onlyican - the query refers to including a valid link in a form stored in a varaible that does not cause an error when echoed as that variable from an include file.Cheers Quote Link to comment https://forums.phpfreaks.com/topic/19621-embedding-php/#findComment-85450 Share on other sites More sharing options...
Jenk Posted September 4, 2006 Share Posted September 4, 2006 PHP_SELF has vulnerabilities.. use SCRIPT_NAME instead, and to be fully compat, use full URI not just relative:[code]<?phpecho '<form action="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . '" method="post">';?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19621-embedding-php/#findComment-85480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.