Jump to content

Archived

This topic is now archived and is closed to further replies.

alexcrosson

Blog - Add New Entry

Recommended Posts

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.php

Here is the add_entry.php code:
[code]<?php
if(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 Entry
Title:
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.php

This may seem really complicated but maybe you can help.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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]
<?php
if(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.

Share this post


Link to post
Share on other sites
oh yeh. that too. add a ; after the echo. lol. thanks steveclondon. i did notice that. i think -_-" :D

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.