Jump to content

Can I Use Php Code Inside Html Form Action ?


EzwanAbid

Recommended Posts

I'm trying to passing a data by url.. and what I want to know here, is it possible to insert php code inside <form action> ? Like this :

<form id="form56" name="form56" class="wufoo topLabel page" autocomplete="off" enctype="multipart/form-data" method="post" novalidate
action="<?php searchres.php?id=$id?>">

 

Or is there any better way that I can try?

Hope someone can help me here. :)

Link to comment
Share on other sites

I think you mean to do this:

action="searchres.php?id=<?php echo $id; ?>">

 

PS: Remember to typecast the ID to an integer (by using (int)) when retrieving it from wherever, to ensure that no-one can put any HTML content into it and thus attack your users with an XSS (or similar).

Edited by Christian F.
Link to comment
Share on other sites

wow Thank you Christian.. I never expect it was you again..

Thx it's working ! :happy-04: .. but I have another question here..

 

Can I use this code to call 2 field from my database into my html?

mysql_query("SELECT adminfullname,department FROM admin WHERE id='$id'");

 

Those adminfullname and department will refer to the admin table where $id that I send by url just now.

Link to comment
Share on other sites

Thank you very much for helping me all this time Christian... I really appreciate that :happy-04:

I think that was the last question from me for now..because in 4 days I need to present my system to my lecturer as my Finalproject in Diploma IT-Sofware .. and hope they will like it .. :lol:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.