Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: A2xA on August 15, 2008, 12:20:54 PM

Title: using $post for SSI from form.. not working (simple?)
Post by: A2xA on August 15, 2008, 12:20:54 PM
I'm coding up a blogging system using ssi and I'm trying to get the users to enter the "board id" in the form then $post it into the next page


on the first page I've got a form with

<form action="blogid.php" method="post">
<b>Enter Custom Blog ID</b> <input type="text" id="id" />
<input type="submit" />


on the second "blogid.php" page I've got


<?php ssi_boardNews(''<?php echo $_POST["id"]; ?>'); ?> ^for some reason the first ' dosen't show up so I put 2^

Without the $Post and just replacing with a boardid it works perfectly. (like this) <?php ssi_boardNews(2); ?>   Otherwise it gives me this:

You cannot specify a board that doesn't allow guests. Please check the board ID before trying again.

All help will be greatly appreciated  :) I can't seem to work this out.
Title: Re: using $post for SSI from form.. not working (simple?)
Post by: [SiNaN] on August 15, 2008, 01:14:35 PM
Try this code in your second page:

<?php

$_POST
['id'] = (int) $_POST['id'];

ssi_boardNews($_POST['id']);

?>
Title: Re: using $post for SSI from form.. not working (simple?)
Post by: niko on August 15, 2008, 01:31:05 PM
<input type="text" id="id" />

has no name tag so it wont work.
should be:

<input type="text" id="id" name="id" />
Title: Re: using $post for SSI from form.. not working (simple?)
Post by: A2xA on August 15, 2008, 01:33:34 PM
That worked great thanks  ;)
Title: Re: using $post for SSI from form.. not working (simple?)
Post by: [SiNaN] on August 15, 2008, 01:39:22 PM
Opps, I've missed that. Thanks Niko. Marked the topic as solved.