Jump to content

Parse form variable


yandoo

Recommended Posts

Hi there,

 

I have a form that updates a record in a database...At the moment on Update the user is directed to another page....

 

Is there a way i can parse the ID value that was just updated to the other page (like a hyperlink, e.g. ?recordID=<?php echo $row_record['ID']; ?>)......Because i need to parse the ID to the other page!

 

 

Is this possible??? If so how please??

 

Thank You :)

Link to comment
https://forums.phpfreaks.com/topic/98351-parse-form-variable/
Share on other sites

Hello :)

 

Heres the code:

 

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE animal SET BreedID=%s, Age=%s, Sex=%s, Image=%s WHERE AnimalID=%s",
                       GetSQLValueString($_POST['select'], "text"),
                       GetSQLValueString($_POST['age'], "int"),
                       GetSQLValueString($_POST['sex'], "text"),
             
                       GetSQLValueString($_POST['image'], "text"),
                       GetSQLValueString($_POST['AnimalID'], "int"));

  mysql_select_db($database_woodside, $woodside);
  $Result1 = mysql_query($updateSQL, $woodside) or die(mysql_error());

  $updateGoTo = "view_animal_details.php";[code]

[/code]

Link to comment
https://forums.phpfreaks.com/topic/98351-parse-form-variable/#findComment-503296
Share on other sites

Why start a session to pass variables originally defined by the user? Sessions are a great way to track events between pages, but for something as simple as an ID that you might not even want to carry on to the next page (browses away to another page on the domain perhaps) why use the overhead?

 

If you already have a session started, i don't see why you couldn't... but you'd have to verify that id was for that page specifically. If the user browses to another page that uses the same session variable it could result in undesirable effects.

Link to comment
https://forums.phpfreaks.com/topic/98351-parse-form-variable/#findComment-503300
Share on other sites

Hi,

 

oh yes i see it that brill thanks, all fine for 2nd page but how would i parse it from the first after update??? thinkig in terms of hyperlinks

 recordID=<?php echo $row_animal['AnimalID']; ?>

 

Im bit confussed how to put add it

  $updateGoTo = "view_animal_details.php";

 

If thats even the way to do it

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/98351-parse-form-variable/#findComment-503315
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.