FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP : passing a variable along url
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
PHP : passing a variable along url [message #179050] Fri, 07 September 2012 07:12 Go to next message
pritam chavla is currently offline  pritam chavla
Messages: 1
Registered: September 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Hi group i am having a problem now, actually i am trying to submit a form

and want to pass a parameter along url like
this is my form that is on url(http://localhost/userregistration.php)
<form action = "userhandler.php" method = "POST" id = "validate_form" enctype="multipart/form-data" >

<dl>
<dt><label for="user_name">User Name<span class="req" style="color:red;">*</span></label></dt>
<dd><input type="text" name="user_name" id="user_name" class = "required" size="32" maxlength="128" /></dd>
</dl>

<dl>
<dt><label for="password">Password:<span class="req" style="color:red;">*</span></label></dt>
<dd><input type="password" name="password" id="password" class = "required" size="32" maxlength="32" /></dd>
</dl>


</form>

this is form is submitting on userhandler.php where i am planning to take another parameter org_name
so far i am passing the org_name on
http://localhost/userregistration.php?org_name=blah


but unfortunately when i am trying to get the parameter on userhandler.php file

it is showing me error i.e

Undefined index: org_name in /opt/lampp/htdocs/UI/user/userhandler.php on line 16



Please help me what i am doing wrong
Re: PHP : passing a variable along url [message #179051 is a reply to message #179050] Fri, 07 September 2012 07:16 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On Friday, September 7, 2012 12:12:36 PM UTC+1, pritam chavla wrote:
> Undefined index: org_name in /opt/lampp/htdocs/UI/user/userhandler.php on line 16
> Please help me what i am doing wrong

I would help you but my crystal ball is playing up and it is only showing me up to line 15!
Re: PHP : passing a variable along url [message #179052 is a reply to message #179050] Fri, 07 September 2012 07:49 Go to previous messageGo to next message
Shake is currently offline  Shake
Messages: 40
Registered: May 2012
Karma: 0
Member
add to buddy list
ignore all messages by this user
Something like this?

<form action="userhandler.php?org_name=<?=$_GET['org_name']?>">

Greetings
Re: PHP : passing a variable along url [message #179053 is a reply to message #179050] Fri, 07 September 2012 08:06 Go to previous messageGo to next message
Olaf S. is currently offline  Olaf S.
Messages: 10
Registered: December 2011
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Am 07.09.2012 13:12, schrieb pritam chavla:
> Hi group i am having a problem now, actually i am trying to submit a form
>
> and want to pass a parameter along url like
> this is my form that is on url(http://localhost/userregistration.php)

> <form action = "userhandler.php" method = "POST" id = "validate_form" enctype="multipart/form-data" >
>
> <dl>
> <dt><label for="user_name">User Name<span class="req" style="color:red;">*</span></label></dt>
> <dd><input type="text" name="user_name" id="user_name" class = "required" size="32" maxlength="128" /></dd>
> </dl>
>
> <dl>
> <dt><label for="password">Password:<span class="req" style="color:red;">*</span></label></dt>
> <dd><input type="password" name="password" id="password" class = "required" size="32" maxlength="32" /></dd>
> </dl>
Add this line:
<input type="hidden" name="org-name" value="blah">


>
>
> </form>
>
Re: PHP : passing a variable along url [message #179076 is a reply to message #179050] Tue, 11 September 2012 08:51 Go to previous messageGo to next message
dev is currently offline  dev
Messages: 3
Registered: September 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
On userhandler.php define the variable org_name
if($_GET['org_name']!='')
{
$org_name = $_GET['org_name'];
}
else
{
$org_name = '';
}
Re: PHP : passing a variable along url [message #179079 is a reply to message #179076] Tue, 11 September 2012 09:34 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 9/11/2012 8:51 AM, vivek wrote:
> On userhandler.php define the variable org_name
> if($_GET['org_name']!='')
> {
> $org_name = $_GET['org_name'];
> }
> else
> {
> $org_name = '';
> }
>
>

Which will give an E_NOTICE if $_GET['org_name'] is not set.

You should always use isset() to ensure a parameter is set before trying
to use it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Please help In if else while using array
Next Topic: average rate
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Dec 11 04:23:49 EST 2017

Total time taken to generate the page: 0.00786 seconds