alexcrosson Posted October 2, 2006 Share Posted October 2, 2006 Okay i'll try to explain this as best as possible. There is the main.php page. and when you click a link name Add Entry, it includes add_entry.phpHere is the add_entry.php code:[code]<?phpif(isset($_POST['submit'])); { echo "This seems to work"}?><h2>Add Entry</h2><form name="Add Entry" action="<?php echo $_POST['a']=add_entry; $_SERVER['PHP_SELF'];?>" method="POST"><label for="title">Title:</label><input name="blgtitle" id="blgtitle" type="text" /><label for="content">Content:</label><textarea name="blgcontent" cols="35" rows="4" id="blgcontent"></textarea><p><input type="submit" name="submit" value="Submit" /></p></form>[/code]Its pretty basic. This is wear I will be able to add blog entries but i have some problems. When my site includes this page it gives me the following output:[quote]This seems to work.Add EntryTitle: Content:[/quote]The "This seems to work" part should only display when the form has been submited right? And the <? $_SERVER['PHP_SELF'];?> won't work because it reloads the main.php page, not the add_entry.phpThis may seem really complicated but maybe you can help. Quote Link to comment Share on other sites More sharing options...
steveclondon Posted October 2, 2006 Share Posted October 2, 2006 I might be having a slow day but don't understand why you are going about this the way you are. Why not just put the location that you want the form to post to in the location box. If you want the form to submit to itself you need the $_SERVER['REQUEST_URI'] echoed in the action location on the form header. (this will not work on a windows server) Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted October 2, 2006 Share Posted October 2, 2006 i am not sure if this will work. but i have never had anything like this. you have a ; after the if statement. try taking that away. so it would be this:[code]<?phpif(isset($_POST['submit'])){ echo "This seems to work"}?>[/code] now the $_SERVER['PHP_SELF'] bit. Are you supposed to echo that bit and not the $_POST['a']=add_entry. Because your closing the line with the ; so maybe try echoing the $_SERVER['PHP_SELF'];Hope i helped. Quote Link to comment Share on other sites More sharing options...
steveclondon Posted October 2, 2006 Share Posted October 2, 2006 yes i have just noticed as well you have no ; after your echo statement. Unless this is just a typo here Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted October 2, 2006 Share Posted October 2, 2006 oh yeh. that too. add a ; after the echo. lol. thanks steveclondon. i did notice that. i think -_-" :D Quote Link to comment 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.