thilss0o
07-03-2010, 04:29 PM
I'm having a similiar problem to this thread (http://codingforums.com/showthread.php?t=199362) but not exactly as i can't retrieve the AI generated ID of the row i just posted to.
I have two pages (HTML):
<form method="post" class="uniForm" action="global/guest.php">
<fieldset class="inlineLabels">
<div class="ctrlHolder">
<label for="FullName"><em>*</em>Full Name</label>
<input name="FullName" id="FullName" value="" size="35" maxlength="30" type="text" class="textInput" />
<p class="formHint">E.g.: Jonathan Doe</p>
</div>
<div class="buttonHolder">
<button type="submit" name="submit" value="submit" class="primaryAction">Submit</button>
</div>
</fieldset>
</form>
...and thats repeated a couple times but etc. etc. w/e
Page two, where the results from the form are being posted and inserted into the db and than displayed
<?php
$FullName = $_POST["FullName"];
mysql_connect ("localhost", "user", "pass") or die ('Could not connect');
mysql_select_db ("dbname");
$query="INSERT INTO guest
(ID, FullName)
VALUES
('NULL', '".$FullName."')";
mysql_query($query) or die ('data was not submitted to db');
echo "this is the ID: ". $ID."
<table>
<tr><td><b>Full Name:</b></td><td> ". $FullName." </td></tr>
</table>";
?>
but the id does not appear where i have the echo to show the id
can this not be done on the same page as the post and insert?
I have two pages (HTML):
<form method="post" class="uniForm" action="global/guest.php">
<fieldset class="inlineLabels">
<div class="ctrlHolder">
<label for="FullName"><em>*</em>Full Name</label>
<input name="FullName" id="FullName" value="" size="35" maxlength="30" type="text" class="textInput" />
<p class="formHint">E.g.: Jonathan Doe</p>
</div>
<div class="buttonHolder">
<button type="submit" name="submit" value="submit" class="primaryAction">Submit</button>
</div>
</fieldset>
</form>
...and thats repeated a couple times but etc. etc. w/e
Page two, where the results from the form are being posted and inserted into the db and than displayed
<?php
$FullName = $_POST["FullName"];
mysql_connect ("localhost", "user", "pass") or die ('Could not connect');
mysql_select_db ("dbname");
$query="INSERT INTO guest
(ID, FullName)
VALUES
('NULL', '".$FullName."')";
mysql_query($query) or die ('data was not submitted to db');
echo "this is the ID: ". $ID."
<table>
<tr><td><b>Full Name:</b></td><td> ". $FullName." </td></tr>
</table>";
?>
but the id does not appear where i have the echo to show the id
can this not be done on the same page as the post and insert?