hi anybody out there, i need help, how do i change the value of a URL argument?
Example:
URL: http://localhost/main.php?name='abc'&age='24'

how do i change the value of argument "name" and resend the information back to main.php without changing the age value.

Hi chunguy,

Try this code:

http://www.fpepito.org/php/test4.php
http://www.fpepito.org/php/test4.txt

I hope that help to resolve,

fpepito

##### main.php

<?

if (isset($name)) {
  echo "You have enter with the name: <B>$name</B><BR><BR>\n";
}

if (isset($name) && ! isset($ok)) {
   $name = "new_name";
}

if (isset($name)) {
 echo "welcome <B>$name</B><BR>\n";
 echo "<A HREF=$PHP_SELF?name=$name&age=$age&ok=1>Reload this page</A><BR>\n";
} else {
 echo "<FORM ACTION=$PHP_SELF>\n";
 echo "Name : <INPUT TYPE=TEXT NAME=name><BR>\n";
 echo "Age : <INPUT TYPE=TEXT NAME=age><BR>\n";
 echo "<INPUT TYPE=submit value=\"Identify\">\n";
 echo "</FORM>\n";
}

?>

thanks. alternatively, i've found that you can actually the function ereg_replace().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.