Jump to content

[SOLVED] This form doesn't submit?


FlyingIsFun1217

Recommended Posts

Hey!

 

I've in the past used a drop-down, and retrieved the value for the item selected, forwarded to another page using that as part of the url. In the past, this has worked just fine, but now, it's not sending the values:

 

<form action="eiAction.php">
			<select name="newsToEdit" method="post">

				<?php
					include('connectInfo.php');
					include('createConnection.php');

					$newsQuery = mysql_query('SELECT number, title, content FROM news ORDER BY number DESC');

					while($newsData = mysql_fetch_array($newsQuery, MYSQL_ASSOC))
					{
						$number = $newsData['number'];
						$title = $newsData['title'];

						echo '<option value="'.$number.'">'.$title.'</option>';
					}

					include('closeConnection.php');
				?>

			</select>
			<br>
			<input type="submit" value="Get Contents">
		</form>

 

$number = $_POST['newsToEdit'];

echo '<script type="text/javascript">';
echo 'window.location = "edit.php?post='.$number.'"';
echo '</script>';

 

Shouldn't this work? When I comment out the javascript redirect and echo back the value for $number, I just get a blank page.

 

Thanks for the help again!

FlyingIsFun1217

Link to comment
https://forums.phpfreaks.com/topic/114349-solved-this-form-doesnt-submit/
Share on other sites

Archived

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

×
×
  • Create New...

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.