ChrisMartino Posted March 14, 2010 Share Posted March 14, 2010 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Your website name | Homepage</title> <!-- This template was created by Mantis-a [http://www.mantisa.cz/]. For more templates visit Free website templates [http://www.mantisatemplates.com/]. --> <meta name="Description" content="..." /> <meta name="Keywords" content="..." /> <meta name="robots" content="all,follow" /> <meta name="author" content="..." /> <!-- Javascript --> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <!-- CSS --> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection, tv" /> <link rel="stylesheet" href="css/style-print.css" type="text/css" media="print" /> <!-- Favicon --> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> </head> <body> <div id="wrapper"> <!-- Header --> <div id="header"> <div id="header-arrow"></div> </div> <!-- Header end --> <!-- Menu --> <a href="#skip-menu" class="hidden">Skip menu</a> <ul id="menu" class="cleaning-box"> <li><a href="index.php" class="active">Home</a></li> <li class="first"><a href="image.php">Create a Image</a></li> <li><a href="maps.php">Map Converter</a></li> <li><a href="firstsamp.php">First SA-MP Server</a></li> <li><a href="contact.php">Contact</a></li> </ul> <!-- Menu end --> <hr class="noscreen" /> <div id="content-box"> <div id="content-box-in"> <a name="skip-menu"></a> <!-- Content left --> <div class="content-box-left"> <div class="content-box-left-in"> <?php if($_GET['online'] == "") { ?> <h3>Create a Image</h3> <p class="text-content"> <form action="image.php?online=true" method="get"> IP: <input type="text" name="ip" /> Port: <input type="text" name="port" /> <input type="submit" /> </form> </p> <div class="gallery"> </div> <?php } elseif($_GET[online] == "true") { $ServerImage = "sig.php?$_GET[ip]&port=$_GET[port]"; echo' <h3> Your image : </h3>'; echo'<img src="$ServerImage" />'; } ?> </div> </div> <!-- Content left end --> <hr class="noscreen" /> <!-- Content right --> <div class="content-box-right"> <h4>News</h4> <div class="content-box-right-in"> <dl> <dt>Website Created</dt> <dd>We have got the website up and running!.</dd> <dt>Map Converter</dt> <dd>Map converter coming soon!.</dd> </dl> </div> <div id="column-right-bottom"> </div> </div> <!-- Content right end --> <div class="cleaner"> </div> </div> </div> <hr class="noscreen" /> <!-- Footer --> <div id="footer"> <p class="left">© <a class="b" href="#">SA-MP SigZ</a> 2010</p> </div> <!-- Footer end --> </div> </body> </html> It's supposed to goto image.php?online=true when you hit submut but instead, It dose image.php?ip=SomeIpHere&port=SomePortHere ?, I'm stumped can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/ Share on other sites More sharing options...
wildteen88 Posted March 14, 2010 Share Posted March 14, 2010 Change <form action="image.php?online=true" method="get"> To <form action="image.php?online=true" method="post"> In image.php you'd need to use $_POST['ip'] and $_POST['port'] to get the ip/port Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025933 Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2010 Share Posted March 14, 2010 Your form method is 'get'. That causes any form data to be appended to the end of the URL being requested, thereby replacing any get parameter you put on the end of the URL. You would need to use a hidden form field to set online=true as part of the URL or you would need to use the post method. Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025934 Share on other sites More sharing options...
ChrisMartino Posted March 14, 2010 Author Share Posted March 14, 2010 Thanks guys all worked fine brilliant!. Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025942 Share on other sites More sharing options...
ChrisMartino Posted March 14, 2010 Author Share Posted March 14, 2010 One last thing, Um, i want to echo some information into a text field, like one of these: <input type="text" name="ip" /> But how to i echo the text into one of those, but make it so you can't replace whats in it? Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025944 Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2010 Share Posted March 14, 2010 make it so you can't replace whats in it Anything put into a form can be altered. The only sure way to prevent something from being altered or replaced is to not put it into the hands of the visitor. If you want to display a value, go ahead, but keep and use the actual value on the server only. Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025945 Share on other sites More sharing options...
ChrisMartino Posted March 14, 2010 Author Share Posted March 14, 2010 hmmm so how could i just make it echo some text into one of those fields then ? :/ Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025954 Share on other sites More sharing options...
wildteen88 Posted March 14, 2010 Share Posted March 14, 2010 To add a value to a form field use the value="" html attribute. Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025956 Share on other sites More sharing options...
ChrisMartino Posted March 14, 2010 Author Share Posted March 14, 2010 i did this: $BBCode = ""; Direct Code: <input type="text" value"<?=$BBCode?>" /> but it wont display it in the field :/ Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025964 Share on other sites More sharing options...
wildteen88 Posted March 14, 2010 Share Posted March 14, 2010 Post your message again . Use or tags when posting code. Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025969 Share on other sites More sharing options...
ChrisMartino Posted March 14, 2010 Author Share Posted March 14, 2010 i did this: $BBCode = "[img=http://sig.php?ip=$_POST[ip]&port=$_POST[port]]"; Direct Code: <input type="text" value"<?=$BBCode?>" /> but it wont display it in the field :/ Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025971 Share on other sites More sharing options...
wildteen88 Posted March 14, 2010 Share Posted March 14, 2010 Use full PHP syntax, <input type="text" value"<?php echo $BBCode; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025975 Share on other sites More sharing options...
ChrisMartino Posted March 14, 2010 Author Share Posted March 14, 2010 It still didnt echo it :/ Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025980 Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2010 Share Posted March 14, 2010 That's not the syntax that wildteen88 showed - To add a value to a form field use the value="" html attribute. Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025989 Share on other sites More sharing options...
ChrisMartino Posted March 14, 2010 Author Share Posted March 14, 2010 this is the code [code=php:0] <?php } elseif($_GET[image] == "create") { $ServerImage = "sig.php?ip=$_POST[ip]&port=$_POST[port]"; $BBCode = "[img=sig.php?ip=$_POST[ip]&port=$_POST[port]]"; echo' <h3> Your image : </h3>'; echo $BBCode; ?> <img src="<?=$ServerImage?>" /> <br> Forum Code: <input type="text" value"<?php echo $BBCode; ?>" /> (Used for embeding in forums) <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025992 Share on other sites More sharing options...
wildteen88 Posted March 14, 2010 Share Posted March 14, 2010 Forum Code: <input type="text" value="<?php echo $BBCode; ?>" /> (Used for embeding in forums) Quote Link to comment https://forums.phpfreaks.com/topic/195199-submit-button-keeps-returning-wrong-url/#findComment-1025998 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.